BEF plugin fails when Dropdown is selected for term filters
>>> [!note] Migrated issue <!-- Drupal.org comment --> <!-- Migrated from issue #3563218. --> Reported by: [plopesc](https://www.drupal.org/user/282415) Related to !187 >>> <h3 id="summary-problem-motivation">Problem/Motivation</h3> <p>Tagify BEF plugin works great for term filters, showing a nice widget when the Selection type used in the Filter configuration is set to "Autocomplete".</p> <p>However, when the Selection type is set to "Dropdown", the view fails, and the log reports the following messages:</p> <pre> 8&nbsp;&nbsp;&nbsp; 15/Dec 07:59&nbsp;&nbsp; php&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Error&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Drupal\Component\Plugin\Exception\PluginNotFoundException: The "" entity type does not exist. in Drupal\Core\Entity\EntityTypeManager-&gt;getDefinition() (line 142 of /var/www/html/docroot/co&nbsp; <br>&nbsp; 7&nbsp;&nbsp;&nbsp; 15/Dec 07:59&nbsp;&nbsp; php&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Warning&nbsp;&nbsp;&nbsp; Warning: Undefined array key "#tags" in Drupal\tagify\Plugin\better_exposed_filters\filter\Tagify-&gt;exposedFormAlter() (line 83 of /var/www/html/docroot/modules/contrib/tagify/src/Plugin/be&nbsp; <br>&nbsp; 6&nbsp;&nbsp;&nbsp; 15/Dec 07:59&nbsp;&nbsp; php&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Warning&nbsp;&nbsp;&nbsp; Warning: Undefined array key "#target_type" in Drupal\tagify\Plugin\better_exposed_filters\filter\Tagify-&gt;exposedFormAlter() (line 82 of /var/www/html/docroot/modules/contrib/tagify/src/Pl</pre><p>This is because the dropdown widget does not provide the necessary variables to build the Tagify widget.</p> <h4 id="summary-steps-reproduce">Steps to reproduce</h4> <ol> <li>Install BEF and Tagify modules</li> <li>Create a View that exposed a filter to a taxonomy term field</li> <li>In the filter configuration Select "Autocomplete" as the Selection Type</li> <li>Configure BEF for the filter above and set Tagify as the BEF plugin</li> <li>Save the view</li> <li>Exposed filter works as expected</li> <li>Modify the filter configuration to use "Dropdown" as the Selection Type</li> <li>Save the view</li> <li>Confirm that a PHP error is thrown and the view cannot recover from it</li> </ol> <h3 id="summary-proposed-resolution">Proposed resolution</h3> <ul> <li>Implement isApplicable method to ensure that Tagify plugin is available if only Autocomplete is the option chosen for terms</li> <li>Add a security clause in the code to fail gracefully if for any reason the form element cannot be configured properly.</li> </ul> <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> > Related issue: [Issue #3539738](https://www.drupal.org/node/3539738)
issue