Twig Slugify

Categories

Component ID

2764855

Component name

Twig Slugify

Component type

module

Maintenance status

Development status

Component security advisory coverage

not-covered

Component created

Component changed

Component body

Very simple module that provides a new Twig filter to create a slug from a string in a template.

Requirements

Install Composer

Usage

  • Require the module with Composer (or install Composer Manager module and run composer drupal-update, so Composer can install dependencies)
  • Enable the module
  • Use in your template : content.foo | slugify

Disclamer

This module is a quick-and-dirty implementation of Cocur's Slugify project that I needed for my current client project. It can obviously be improved and lacks tests, but can also be incredibly helpful if you don't need anything fancier than a slug filter.