Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/drupal-pattern-lab/add-attributes-twig-extension
add_attributes twig extension
https://github.com/drupal-pattern-lab/add-attributes-twig-extension
drupal drupal-8 pattern-lab twig
Last synced: about 1 month ago
JSON representation
add_attributes twig extension
- Host: GitHub
- URL: https://github.com/drupal-pattern-lab/add-attributes-twig-extension
- Owner: drupal-pattern-lab
- License: gpl-2.0
- Created: 2017-08-11T20:38:39.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2019-10-31T15:36:56.000Z (about 5 years ago)
- Last Synced: 2024-09-19T19:11:03.487Z (3 months ago)
- Topics: drupal, drupal-8, pattern-lab, twig
- Language: PHP
- Homepage:
- Size: 9.77 KB
- Stars: 8
- Watchers: 1
- Forks: 4
- Open Issues: 6
-
Metadata Files:
- Readme: README.md
- License: LICENSE.txt
Awesome Lists containing this project
- component-based-theming - add-attributes-twig-extension
README
# add-attributes-twig-extension
Twig function that allows addition of attributes that can be rendered in both Drupal and Pattern Lab. Merges with template level attributes in Drupal and prevents them from trickling down into includes.
## Usage
```
{% set additional_attributes = {
"class": ["foo", "bar"],
"baz": ["foobar", "goobar"],
"foobaz": "goobaz",
} %}
```Can also be used with the [bem function](https://github.com/drupal-pattern-lab/bem-twig-extension):
```
{% set additional_attributes = {
"class": bem("foo", ["bar", "baz"], "foobar"),
} %}
```