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');
  }
}
Command icon 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

artis.bajars created an issue. See original summary.

shamir.vs made their first commit to this issue’s fork.

shamir.vs’s picture

Status: Active » Needs review

I have created a merge request to address the Compatibility with Drupal 11.3.x issue. Please take a moment to review it. Thank you!

mingsong’s picture

Thanks for reporting this issue and the MR.

I wonder if the proposed fix also work with Drupal 10? Is there any backward compatibility issue?

mingsong’s picture

Status: Needs review » Postponed (maintainer needs more info)
mingsong’s picture

Status: Postponed (maintainer needs more info) » Needs work

According to the PHPUnit test.
https://git.drupalcode.org/project/hierarchy_manager/-/jobs/7967031

It failed with Drupal installed version: 10.6.2

shamir.vs’s picture

Status: Needs work » Needs review

I have updated a merge request to address the backward compatibility issue. Please take a moment to review it. Thank you!

mingsong’s picture

I 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.

mingsong’s picture

Status: Needs review » Postponed (maintainer needs more info)
sirclickalot’s picture

StatusFileSize
new157.38 KB

I 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'...

hierarachy_manager_patch_failer

mingsong’s picture

The MR is mergeable, which means your local branch might be out of date.

sirclickalot’s picture

Thanks @minsong,
Does that mean I need to apply the patch against the latest DEV no the current release?

mingsong’s picture

Yes, 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.

sirclickalot’s picture

StatusFileSize
new40.85 KB

I have installed the DEV module and re-applied Patch 23.

Still no joy in applying the patch...

Patch still failing

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...

Error: Call to a member function getEntityTypeId() on null in Drupal\Core\Entity\EntityForm->getBaseFormId() (line 70 of <site>/core/lib/Drupal/Core/Entity/EntityForm.php).
#0 <site>/core/lib/Drupal/Core/Form/FormBuilder.php(232): Drupal\Core\Entity\EntityForm->getBaseFormId()
#1 <site>/core/lib/Drupal/Core/Form/FormBuilder.php(251): Drupal\Core\Form\FormBuilder->getFormId(Object(Drupal\hierarchy_manager\Form\HmOverviewTerms), Object(Drupal\Core\Form\FormState))
#2 <site>/core/lib/Drupal/Core/Controller/FormController.php(73): Drupal\Core\Form\FormBuilder->buildForm(Object(Drupal\hierarchy_manager\Form\HmOverviewTerms), Object(Drupal\Core\Form\FormState))
#3 [internal function]: Drupal\Core\Controller\FormController->getContentResult(Object(Symfony\Component\HttpFoundation\Request), Object(Drupal\Core\Routing\RouteMatch))
#4 <site>/core/lib/Drupal/Core/EventSubscriber/EarlyRenderingControllerWrapperSubscriber.php(123): call_user_func_array(Array, Array)
#5 <site>/core/lib/Drupal/Core/Render/Renderer.php(634): Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}()
#6 [internal function]: Drupal\Core\Render\Renderer::Drupal\Core\Render\{closure}()
#7 <site>/core/lib/Drupal/Core/Render/Renderer.php(635): Fiber->start()
#8 <site>/core/lib/Drupal/Core/EventSubscriber/EarlyRenderingControllerWrapperSubscriber.php(121): Drupal\Core\Render\Renderer->executeInRenderContext(Object(Drupal\Core\Render\RenderContext), Object(Closure))
#9 <site>/core/lib/Drupal/Core/EventSubscriber/EarlyRenderingControllerWrapperSubscriber.php(97): Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->wrapControllerExecutionInRenderContext(Array, Array)
#10 <site>/vendor/symfony/http-kernel/HttpKernel.php(183): Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}()
#11 <site>/vendor/symfony/http-kernel/HttpKernel.php(76): Symfony\Component\HttpKernel\HttpKernel->handleRaw(Object(Symfony\Component\HttpFoundation\Request), 1)
#12 <site>/core/lib/Drupal/Core/StackMiddleware/Session.php(53): Symfony\Component\HttpKernel\HttpKernel->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#13 <site>/core/lib/Drupal/Core/StackMiddleware/KernelPreHandle.php(48): Drupal\Core\StackMiddleware\Session->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#14 <site>/core/lib/Drupal/Core/StackMiddleware/ContentLength.php(28): Drupal\Core\StackMiddleware\KernelPreHandle->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#15 <site>/core/modules/big_pipe/src/StackMiddleware/ContentLength.php(32): Drupal\Core\StackMiddleware\ContentLength->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#16 <site>/core/modules/page_cache/src/StackMiddleware/PageCache.php(118): Drupal\big_pipe\StackMiddleware\ContentLength->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#17 <site>/core/modules/page_cache/src/StackMiddleware/PageCache.php(92): Drupal\page_cache\StackMiddleware\PageCache->pass(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#18 <site>/core/lib/Drupal/Core/StackMiddleware/ReverseProxyMiddleware.php(48): Drupal\page_cache\StackMiddleware\PageCache->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#19 <site>/core/lib/Drupal/Core/StackMiddleware/NegotiationMiddleware.php(51): Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#20 <site>/core/lib/Drupal/Core/StackMiddleware/AjaxPageState.php(53): Drupal\Core\StackMiddleware\NegotiationMiddleware->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#21 <site>/core/lib/Drupal/Core/StackMiddleware/StackedHttpKernel.php(54): Drupal\Core\StackMiddleware\AjaxPageState->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#22 <site>/core/lib/Drupal/Core/DrupalKernel.php(745): Drupal\Core\StackMiddleware\StackedHttpKernel->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#23 <site>/index.php(19): Drupal\Core\DrupalKernel->handle(Object(Symfony\Component\HttpFoundation\Request))
#24 {main}

Thank you

mingsong’s picture

There 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.

  • mingsong committed d6607009 on 3.x authored by shamir.vs
    feat: #3566990 Compatibility with Drupal 11.3.x
    
    By: artis.bajars
    By:...
mingsong’s picture

Status: Postponed (maintainer needs more info) » Fixed

Merged into the dev branch.

Now, you can install the dev branch to get this patch.

Feel free to report any issues related here.

Now that this issue is closed, review the contribution record.

As a contributor, attribute any organization that helped you, or if you volunteered your own time.

Maintainers, credit people who helped resolve this issue.

sirclickalot’s picture

I confirm that with the latest DEV () install and all caches cleared, I am now able to manage Taxonomies again.

Thank you!

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.