{"id":13513345,"url":"https://github.com/drupal-pattern-lab/add-attributes-twig-extension","last_synced_at":"2025-07-30T01:37:19.223Z","repository":{"id":56972639,"uuid":"100068518","full_name":"drupal-pattern-lab/add-attributes-twig-extension","owner":"drupal-pattern-lab","description":"add_attributes twig extension","archived":false,"fork":false,"pushed_at":"2019-10-31T15:36:56.000Z","size":10,"stargazers_count":8,"open_issues_count":6,"forks_count":4,"subscribers_count":0,"default_branch":"master","last_synced_at":"2025-03-16T21:05:26.452Z","etag":null,"topics":["drupal","drupal-8","pattern-lab","twig"],"latest_commit_sha":null,"homepage":"","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/drupal-pattern-lab.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-08-11T20:38:39.000Z","updated_at":"2021-07-22T17:13:42.000Z","dependencies_parsed_at":"2022-08-21T10:20:14.692Z","dependency_job_id":null,"html_url":"https://github.com/drupal-pattern-lab/add-attributes-twig-extension","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/drupal-pattern-lab%2Fadd-attributes-twig-extension","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/drupal-pattern-lab%2Fadd-attributes-twig-extension/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/drupal-pattern-lab%2Fadd-attributes-twig-extension/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/drupal-pattern-lab%2Fadd-attributes-twig-extension/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/drupal-pattern-lab","download_url":"https://codeload.github.com/drupal-pattern-lab/add-attributes-twig-extension/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246403961,"owners_count":20771526,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["drupal","drupal-8","pattern-lab","twig"],"created_at":"2024-08-01T04:00:53.237Z","updated_at":"2025-03-31T01:32:19.711Z","avatar_url":"https://github.com/drupal-pattern-lab.png","language":"PHP","funding_links":[],"categories":["PHP","External tools"],"sub_categories":["Pattern Lab"],"readme":"# add-attributes-twig-extension\n\nTwig 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.\n\n## Usage\n```\n{% set additional_attributes = {\n  \"class\": [\"foo\", \"bar\"],\n  \"baz\": [\"foobar\", \"goobar\"],\n  \"foobaz\": \"goobaz\",\n} %}\n\n\u003cdiv {{ add_attributes(additional_attributes) }}\u003e\u003c/div\u003e\n```\n\nCan also be used with the [bem function](https://github.com/drupal-pattern-lab/bem-twig-extension):\n```\n{% set additional_attributes = {\n  \"class\": bem(\"foo\", [\"bar\", \"baz\"], \"foobar\"),\n} %}\n\n\u003cdiv {{ add_attributes(additional_attributes) }}\u003e\u003c/div\u003e\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdrupal-pattern-lab%2Fadd-attributes-twig-extension","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdrupal-pattern-lab%2Fadd-attributes-twig-extension","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdrupal-pattern-lab%2Fadd-attributes-twig-extension/lists"}