Implements the cocur/slugify class as a Twig filter for Drupal.
This work carries forward the work in the sandbox here, made compatible for Drupal 9 and 10+.
Usage
After enabling the module you can use the filter in a Twig template on any text field or string value.
Example, on a node with a field_foo value of "This is an Example"
{{ node.field_foo.value|slugify }}
Would render "this-is-an-example".
The filter supports most of the options that the cocur/slugify library supports. For example, disabling the forcing of lowercase and changing the seperator to ***, pass an options object:
{{ node.field_foo.value|slugify({'lowercase': false, "separator": "***"}) }}
Would render "This***is***an***Example".
Supporting organizations:
Supporting Development
Project information
Minimally maintained
Maintainers monitor issues, but fast responses are not guaranteed.Maintenance fixes only
Considered feature-complete by its maintainers.- Project categories: Developer tools
328 sites report using this module
- Created by kevinquillen on , updated
Stable releases for this project are covered by the security advisory policy.
Look for the shield icon below.
