j6s / flow-transliterated-routes

Small package that ties in behat/transliterator with flows IdentityRoutePart to create smart international slugs

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Flow Transliterated Routes Build Status

Small package that ties behat/transliterator into the default behaviour of IdentityRoutePart of the Flow Framework to create smart international slugs.

Installation

$ composer require j6s/flow-transliterated-routes

Example Routes.yaml

- name: 'My.News:DetailPage'
  uriPattern: '{article}'
  routeParts:
    article:
      handler: 'J6s\TransliteratedRoutes\IdentityRoutePart'
      options:
        objectType: 'My\News\Domain\Model\Article'
        uriPattern: '{name}-{urlIdentifier}'
        replacements:
          '&': 'and'
          '|': 'or'

Configuration

All configuration from the default IdentityRoutePart has been retained with the notable difference, that they are shifted into the options key.

Additionally the following options exist:

  • additionalReplacements: Map of replacement that uses the character that should be replaced and it's replacement as a value. In order to be backwards-compatible with Flows default IdentityRoutePart this defaults to replacements for german special characters. If you add replacements of your own and whish to retain german special characters, you have to add them to the map manually.

About

Small package that ties in behat/transliterator with flows IdentityRoutePart to create smart international slugs

License:MIT License


Languages

Language:PHP 100.0%