- 🇺🇸United States codechefmarc
Following up on this one. I'm trying to recreate your issue and I'm not running into that error. Can you show what code is in your twig template that is causing this? I've tried the following:
<div{{ add_attributes(['first', 'second']) }}>
Produces:
<div 0="first" 1="second">
And:
{% set text_field__attributes = { 'my-test-attribute': text_field__width|default(['first', 'second']), } %} <div{{ add_attributes(text_field__attributes) }}>
Produces:
<div my-test-attribute="first second">
- Status changed to Needs review
11 months ago 8:13pm 11 January 2024 - 🇺🇸United States codechefmarc
I've added your fix from the other d.o. issue, @seanB, to the PR over on GitHub (https://github.com/emulsify-ds/emulsify_twig/pull/61) that should address these three Drupal.org issues:
https://www.drupal.org/project/emulsify_twig/issues/3160391 🐛 Check if 'attributes' index is set in bem context Needs review
https://www.drupal.org/project/emulsify_twig/issues/3210140 🐛 Error offsetExists() when i use 'twig_render_template' function Needs work
https://www.drupal.org/project/emulsify_twig/issues/3302662 🐛 PHP error on passing array in attributes variable with add_attributes() Needs workIf someone can review it and let me know if that works, I'll merge that in. Thanks!
- Status changed to Fixed
7 months ago 10:55pm 2 May 2024 - 🇺🇸United States codechefmarc
This has now been fixed as part of version 5.0.0.
Automatically closed - issue fixed for 2 weeks with no activity.