Pass the field definition inside widget hooks to the field widget actions
>>> [!note] Migrated issue <!-- Drupal.org comment --> <!-- Migrated from issue #3572367. --> Reported by: [a.dmitriiev](https://www.drupal.org/user/3235287) Related to !9 >>> <h3 id="summary-problem-motivation">Problem/Motivation</h3> <p>While working on <span class="drupalorg-gitlab-issue-link project-issue-status-info project-issue-status-7"><a href="https://www.drupal.org/project/ai/issues/3566582" title="Status: Closed (fixed)">#3566582: Add Field Widget Actions (FWA) support for llm_media_audio_generation on the media_library_widget</a></span> it was found that <code>isAvailable</code> method when called inside widget alter hooks lacks knowledge about field definition.</p> <h4 id="summary-steps-reproduce">Steps to reproduce</h4> <p>1. Install field widget actions module.<br> 2. Install AI Automators module.<br> 3. Try to use the automator from the issue mentioned above.<br> 4. The automator should be available only for fields that support audio files. But to know this the field widget action should have the field definition set.</p> <h3 id="summary-proposed-resolution">Proposed resolution</h3> <p>Set the field definition inside widget form alter hooks.</p>
issue