packagefactory/hyphenate

Hyphenation for Neos

Installs: 2 243

Dependents: 0

Suggesters: 0

Security: 0

Stars: 4

Watchers: 2

Forks: 1

Open Issues: 1

Type:neos-package

1.1.3 2021-06-29 13:44 UTC

This package is auto-updated.

Last update: 2024-11-29 05:32:35 UTC


README

Fusion Wrapper for phpSyllable

Installation

PackageFactory.Hyphenate is available via packagist. Just add "packagefactory/hyphenate" : "~1.0.0" to the require-section of the composer.json or run composer require packagefactory/hyphenate.

Usage

Text

Just use the PackageFactory.Hyphenate:HyphenateText Fusion object as a processor on the fusion value that should be hyphenated.

someFusionValue = 'Grund­stücks­ver­kehrs­ge­neh­mi­gungs­zu­stän­dig­keits­über­tra­gungs­ver­ord­nung'
someFusionValue.@process.hyphenate = PackageFactory.Hyphenate:HyphenateText {
  locale = 'de'
}

HTML

Similar to text elements you can use PackageFactory.Hyphenate:HyphenateHtml for HTML elements.

someFusionHtml.@process.hyphenate = PackageFactory.Hyphenate:HyphenateHtml {
  locale = 'de'
}

Neos CMS integration example

You can easily activate hyphenation for all Neos CMS text- and headline nodetypes with following Fusion code:

prototype(Neos.NodeTypes:Text) {
  text.@process.hyphenate = PackageFactory.Hyphenate:HyphenateHtml
}

prototype(Neos.NodeTypes:Headline) {
  title.@process.hyphenate = PackageFactory.Hyphenate:HyphenateHtml
}

Parameters

locale (string) : Reference to the language in which the given string will be hyphenated (Have a look at https://github.com/vanderlee/phpSyllable/tree/master/languages for a reference of available languages)

threshold (integer, default = 0) : Minimum amount characters a word needs to have, before it is being hyphenated.

License

see LICENSE file