Tagify form elements process functions override the #attached property
>>> [!note] Migrated issue <!-- Drupal.org comment --> <!-- Migrated from issue #3558997. --> Reported by: [plopesc](https://www.drupal.org/user/282415) Related to !186 !185 !183 >>> <h3 id="summary-problem-motivation">Problem/Motivation</h3> <p>Both entity_autocomplete_tagify and select_tagify form elements overrides the '#attached' property from the form element defined by the original form render array.</p> <p>This leads to unexpected missing libraries and breaks integration with 3rd party modules like dependent_fields.</p> <h4 id="summary-steps-reproduce">Steps to reproduce</h4> <p>Create a form element like: </p> <pre>[<br>&nbsp; '#type' =&gt; 'select_tagify',<br>....<br>&nbsp; '#attached' =&gt; [<br>&nbsp;&nbsp;&nbsp; 'library' =&gt; [<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 'my_module/my_library',<br>&nbsp;&nbsp;&nbsp; ]<br>&nbsp; ]<br>]</pre><p>After processSelectTagify, the ouput is:</p> <pre>[<br>&nbsp; '#type' =&gt; 'select_tagify',<br>....<br>&nbsp; '#attached' =&gt; [<br>&nbsp;&nbsp;&nbsp; 'library' =&gt; [<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 'my_module/my_library',<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 'tagify/tagify',<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 'tagify/default',<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 'tagify/tagify_polyfils',<br>&nbsp;&nbsp;&nbsp; ]<br>&nbsp; ]<br>]</pre><p>And it should be:</p> <pre>[<br>&nbsp; '#type' =&gt; 'select_tagify',<br>....<br>&nbsp; '#attached' =&gt; [<br>&nbsp;&nbsp;&nbsp; 'library' =&gt; [<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 'tagify/tagify',<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 'tagify/default',<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 'tagify/tagify_polyfils',<br>&nbsp;&nbsp;&nbsp; ]<br>&nbsp; ]<br>]</pre><h3 id="summary-proposed-resolution">Proposed resolution</h3> <p>Merge the attached arrays instead of override them.</p> <h3 id="summary-remaining-tasks">Remaining tasks</h3> <h3 id="summary-ui-changes">User interface changes</h3> <h3 id="summary-api-changes">API changes</h3> <h3 id="summary-data-model-changes">Data model changes</h3>
issue