Problem/Motivation
In Drupal 11.3.x the Drupal\taxonomy\Form\OverviewTerms form has been changed to extend Drupal\Core\Entity\EntityForm and the overview route to $route->setDefault('_entity_form', 'taxonomy_vocabulary.overview'). See the change record: https://www.drupal.org/node/3528300
As a result Hierarchy manager throws a fatal error when attempting to visit any vocabulary overview page: Error: Call to a member function getEntityTypeId() on null in Drupal\Core\Entity\EntityForm->getBaseFormId() (line 70 of /app/web/core/lib/Drupal/Core/Entity/EntityForm.php).
Steps to reproduce
- Install any Drupal core from version 11.3.0 and up
- Install and enable Hierarchy manager
- Create a vocabulary and attempt to view the term overview page
Proposed resolution
Drop the route altering in HmRouteSubscriber.php and use a hook instead:
/**
* Implements hook_entity_type_build().
*/
function hierarchy_manager_entity_type_build(array &$entity_types) {
if (isset($entity_types['taxonomy_vocabulary'])) {
// Swap the class for the 'overview' form operation.
$entity_types['taxonomy_vocabulary']->setFormClass('overview', 'Drupal\hierarchy_manager\Form\HmOverviewTerms');
}
}
| Comment | File | Size | Author |
|---|---|---|---|
| #16 | 2026-01-21_06-29-51.png | 40.85 KB | sirclickalot |
| #12 | hierarachy_manager_patch_failer.png | 157.38 KB | sirclickalot |
Issue fork hierarchy_manager-3566990
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
Comments
Comment #4
shamir.vs commentedI have created a merge request to address the Compatibility with Drupal 11.3.x issue. Please take a moment to review it. Thank you!
Comment #5
mingsongThanks for reporting this issue and the MR.
I wonder if the proposed fix also work with Drupal 10? Is there any backward compatibility issue?
Comment #6
mingsongComment #7
mingsongAccording to the PHPUnit test.
https://git.drupalcode.org/project/hierarchy_manager/-/jobs/7967031
It failed with Drupal installed version: 10.6.2
Comment #8
shamir.vs commentedI have updated a merge request to address the backward compatibility issue. Please take a moment to review it. Thank you!
Comment #9
mingsongComments on the MR:
https://git.drupalcode.org/project/hierarchy_manager/-/merge_requests/23...
https://git.drupalcode.org/project/hierarchy_manager/-/merge_requests/23...
Comment #10
mingsongI updated the MR to solve the issues raised before.
Please test it with D11 & D10.
Once we can confirm it works for all supported versions, I can merge it.
Comment #11
mingsongComment #12
sirclickalotI have attempted to apply patch 23 from #11 but the patch would not apply successfully,
PHP Storm patch manager complains that it 'Cannot apply 1 hunk'...
Comment #13
mingsongThe MR is mergeable, which means your local branch might be out of date.
Comment #14
sirclickalotThanks @minsong,
Does that mean I need to apply the patch against the latest DEV no the current release?
Comment #15
mingsongYes, you are right.
I am assuming you get the 'patch' from the merge request, as no patch provided here.
In Drupal.org, in most of cases, a merge request is based on the latest develop branch not a release tag.
Comment #16
sirclickalotI have installed the DEV module and re-applied Patch 23.
Still no joy in applying the patch...
I'm afraid I cannot provide any more insights here as my attempt was made with PHP Storm on Mac this time but it doesn't seem to give quite the same level of feedback as yo why it failed.
Nonetheless, I hope this feedback is of some use.
I added a bit of debugging code to my custom 'tweaks' module and was able to uncover the following which might prove useful...
Thank you
Comment #17
mingsongThere is another way to get the code (patched version) is clone the fork branch to your project rather than applying a patch from a MR(#23). I am pretty sure there are many resources out there about how to do that. Sorry I can’t help more on git or version control.
Comment #19
mingsongMerged into the dev branch.
Now, you can install the dev branch to get this patch.
Feel free to report any issues related here.
Comment #21
sirclickalotI confirm that with the latest DEV () install and all caches cleared, I am now able to manage Taxonomies again.
Thank you!