Main forum overview form is an EntityForm but does not implement interface properly
>>> [!note] Migrated issue <!-- Drupal.org comment --> <!-- Migrated from issue #3567960. --> Reported by: [eelkeblok](https://www.drupal.org/user/423078) Related to !33 >>> <h3 id="summary-problem-motivation">Problem/Motivation</h3> <p>The main forum overview form (Drupal\forum\Form\Overview) extends the OverviewTerms form from the Taxonomy module, which in turn is an EntityForm. The EntityFormInterface has a getEntity method, which, according to the interface defininition, should return a Drupal\Core\Entity\EntityInterface (and not NULL). For the forums overview form, that entity is never set, so the method does return NULL.</p> <p>Normally, I would not be too worried about this, but the site I'm working on has <a href="https://drupal.org/project/rabbit_hole">Rabbit Hole</a> installed. This contains a form alter, which checks if the form is an EntityFormInterface and then, you guessed it, calls getEntity(). One might argue that Rabbit Hole should then check if it got an entity before proceeding. One might also argue that Drupal\forum\Form\Overview should stick to its contract and return an entity from its getEntity() method.</p> <p>Similarly, Simple XML Sitemap will expect an operation to be set for the form, which also is not set in this case.</p> <h4 id="summary-steps-reproduce">Steps to reproduce</h4> <p>The easiest is to install Rabbit Hole and Simple XML Sitemap (best enable them separately to see the individual issues) and visit /admin/structure/forum. Maybe there are other situations where this is a problem, though.</p> <h3 id="summary-proposed-resolution">Proposed resolution</h3> <p>Return the forum vocabulary from the getEntity() method for the Overview form. I doubt this would ever have any ill effects, and means the Interface is more accurately implemented.</p> <h3 id="summary-remaining-tasks">Remaining tasks</h3> <ul> <li>Create MR</li> <li>Review</li> <li>Merge</li> </ul> <h3 id="summary-ui-changes">User interface changes</h3> <p>None. Well, the UI will actually work when Rabbit Hole is installed.</p> <h3 id="summary-api-changes">API changes</h3> <p>The getEntity() method for the Overview form will now return the forums vocabulary.</p> <h3 id="summary-data-model-changes">Data model changes</h3> <p>None.</p>
issue