"Defined by token" does not work in "Form: add submit button" action
>>> [!note] Migrated issue <!-- Drupal.org comment --> <!-- Migrated from issue #3559340. --> Reported by: [starlight-sparkle](https://www.drupal.org/user/3804225) Related to !570 >>> <h3 id="summary-problem-motivation">Problem/Motivation</h3> <p>When I try to use "Defined by token" option for the "Button type" configuration in the "Form: add submit button" action, it always sets the <code>&lt;input&gt;</code> element class to <code>"button--_eca_token"</code> when the action is executed.</p> <h4 id="summary-steps-reproduce">Steps to reproduce</h4> <ol> <li>Enable ECA render, ECA base and ECA form modules</li> <li> Create a model <ol> <li>Form: build event</li> <li>Token: set value (Name: <code>eca_form_add_submit_button_button_type</code> Value: <code>outline</code>)</li> <li>Form: add submit button (Button type: <code>Defined by token</code>)</li> </ol> </li> <li>Observe that the resulting submit button has the class <code>"button--_eca_token"</code> instead of <code>"button--outline"</code>.</li> </ol> <h3 id="summary-proposed-resolution">Proposed resolution</h3> <p>Resolve the logical error in <code>FormAddSubmitButton::execute()</code>; variable <code>$button_type</code> is set to the token value, but never used.</p> <div class="codeblock"> <pre><span style="color: #000000"><span style="color: #0000BB">&lt;?php<br>&nbsp;&nbsp;&nbsp; </span><span style="color: #007700">if (</span><span style="color: #0000BB">$button_type </span><span style="color: #007700">=== </span><span style="color: #DD0000">'_eca_token'</span><span style="color: #007700">) {<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span><span style="color: #0000BB">$button_type </span><span style="color: #007700">= </span><span style="color: #0000BB">$this</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">getTokenValue</span><span style="color: #007700">(</span><span style="color: #DD0000">'button_type'</span><span style="color: #007700">, </span><span style="color: #DD0000">'_none'</span><span style="color: #007700">);<br>&nbsp;&nbsp;&nbsp; }<br>&nbsp;&nbsp;&nbsp; if (!empty(</span><span style="color: #0000BB">$button_type</span><span style="color: #007700">) &amp;&amp; (</span><span style="color: #0000BB">$button_type </span><span style="color: #007700">!== </span><span style="color: #DD0000">'_none'</span><span style="color: #007700">)) {<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span><span style="color: #0000BB">$button_element</span><span style="color: #007700">[</span><span style="color: #DD0000">'#button_type'</span><span style="color: #007700">] = </span><span style="color: #0000BB">$this</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">configuration</span><span style="color: #007700">[</span><span style="color: #DD0000">'button_type'</span><span style="color: #007700">];<br>&nbsp;&nbsp;&nbsp; }<br></span><span style="color: #0000BB">?&gt;</span></span></pre></div> <h3 id="summary-remaining-tasks">Remaining tasks</h3> <h3 id="summary-ui-changes">User interface changes</h3> <p>No changes.</p> <h3 id="summary-api-changes">API changes</h3> <p>No changes.</p> <h3 id="summary-data-model-changes">Data model changes</h3> <p>No changes.</p>
issue