library twig-extension
A Twig extension providing convenience methods for context-specific HTML classes.
jswhetstone/twig-extension
A Twig extension providing convenience methods for context-specific HTML classes.
- Wednesday, June 18, 2014
- by jswhetstone
- Repository
- 1 Watchers
- 0 Stars
- 1,476 Installations
- PHP
- 1 Dependents
- 0 Suggesters
- 0 Forks
- 0 Open issues
- 1 Versions
- 3 % Grown
jswhetstone/twig-extension
Some useful Twig functions for context-relevant class rendering., (*1)
{{ getActiveClass('/some/page') }}, (*2)
Will return 'active' (without quotes) if the current URI contains the string specified.
Good for rendering the active state on Bootstrap nav elements.
Pass an empty string '' to check for root., (*3)
{{ getPageClasses() }}, (*4)
Will return a class-ready string representation of the current URI.
Each directory in the hierarchy is represented by a separate class.
The root directory will return 'home' (without quotes)., (*5)
license
This code is licensed under WTFPL, (*6)
dev-master
9999999-dev
A Twig extension providing convenience methods for context-specific HTML classes.
Sources
Download
WTFPL