I tried to reproduce what's mentioned in the issue but i was not able to do that.I will write some steps that i took trying to reproduce the issue.
Steps to reproduce:-
1) Install the ajax form test module.
2) go to /ajax_forms_test_get_form url.
3) In the buildform method I modified the following select element as below:-$form['select'] = [ '#title' => $this->t('Color'), '#type' => 'select', '#options' => [ 'red' => 'red', 'green' => 'green', 'blue' => 'blue', ], '#attributes' => $attributes->toArray(), '#ajax' => [ 'callback' => [$object, 'selectCallback'], ], '#suffix' => '<div id="ajax_selected_color">No color yet selected</div>', ]; $form['select']['#attributes']['class'][] = 'TestingAttributes';
With the above changes applied I should get the error mentioned above, but i was able to get the class rendered on the page.
Attaching the SS for the same.
I also tried the same steps on system.admin.inc file and modified the way attributes is added on line 285 and 294 but there also i was able to get the class rendered.It would be great if someone who can reproduce this, add some steps to reproduce in the issue summary.
- ๐ฌ๐งUnited Kingdom joachim
The steps to reproduce are already in the issue summary.
- ๐ฎ๐ณIndia yash.rode pune
yash.rode โ made their first commit to this issueโs fork.
- Status changed to Needs work
7 months ago 8:46am 6 June 2024 - ๐ฌ๐งUnited Kingdom joachim
Thanks for working on this!
Tests are failing however.
Also, I don't think it's a good idea to put a special case for a particular data provider in a data-provided test method. Better to add a dedicated test method for this case. It's a unit test anyway, so it's fast.
- Status changed to Needs review
7 months ago 9:24am 6 June 2024 - Status changed to Needs work
7 months ago 5:51pm 10 June 2024 - ๐บ๐ธUnited States smustgrave
Sorry can the issue summary be updated to include a proposed solution. Not sure if this is an api change or not (didn't look deeply).
Thanks.
- Status changed to Needs review
7 months ago 6:09pm 10 June 2024 - ๐ฌ๐งUnited Kingdom joachim
This isn't an API change, it's fixing a PHP error you get if you try to use Attribute with the array access as documented.
The proposed solution is 'make it work properly'.
- ๐บ๐ธUnited States smustgrave
Not sure that's a proper summary lol so will just leave here for the next reviewer. Seen enough issues kicked back for not having proper issue summary.
- ๐ฌ๐งUnited Kingdom joachim
I'll remove the 'TBD' because that doesn't look good, but honestly I don't see that there's anything relevant to put there.
Doing $attributes['class'][] = 'black-white-cat'; produces an error. Make it not produce an error.
- Status changed to Needs work
6 months ago 11:29am 20 June 2024 The Needs Review Queue Bot โ tested this issue. It no longer applies to Drupal core. Therefore, this issue status is now "Needs work".
This does not mean that the patch necessarily needs to be re-rolled or the MR rebased. Read the Issue Summary, the issue tags and the latest discussion here to determine what needs to be done.
Consult the Drupal Contributor Guide โ to find step-by-step guides for working with issues.
- Status changed to Needs review
6 months ago 1:26pm 28 June 2024 - Status changed to RTBC
5 months ago 4:05pm 1 August 2024 - ๐บ๐ธUnited States smustgrave
Believe feedback on this one has been addressed.
- Status changed to Needs work
4 months ago 4:02am 14 August 2024 - ๐ณ๐ฟNew Zealand quietone
Left some comments in the MR asking for more comments and some simplification.
- Status changed to Needs review
4 months ago 9:43am 14 August 2024 - ๐ฌ๐งUnited Kingdom joachim
I think I've addressed everything -- the MR is not letting me mark things are resolved?!?!
- ๐บ๐ธUnited States smustgrave
Appears to have a cspell error
And only the original author of the MR can close threads. Which is a bummer
- Status changed to RTBC
4 months ago 3:16pm 14 August 2024 - ๐ฌ๐งUnited Kingdom catch
Committed/pushed to 11.x and cherry-picked to 11.0.x. I think this is worth backporting to 10.4.x but it doesn't cherry-pick cleanly so moving to 'to be ported'.
- Status changed to Downport
4 months ago 8:23am 30 August 2024