- Issue created by @jonsimonsen
- π³π΄Norway jonsimonsen
It seems like the issue appeared after upgrading to 2.2.10. I'll downgrade the site to 2.2.9 for now. The affected taxonomy term pages look quite customised, so it might be difficult to create an exact way of reproducing the issue. I'll see if I can get hold of the person that set this up
- πΊπΈUnited States itmaybejj
Thanks. This will be an easy change but it's nice to able to test.
Finding out "what is this thing and what is its name" is startlingly complicated in Drupal, and edge cases in custom entities are common.
- π³π΄Norway jonsimonsen
but it's nice to able to test.
It's a bit hard for me to specify how to reproduce since I don't know the project very well. I could of course test a patch on my local setup and tell you if it seems to have solved the issue there
- π©πͺGermany szeidler Berlin
The issue is that the following line only works for entities for which the bundle key is `type`, like for nodes.
if (($entity instanceof ContentEntityInterface) && $entity->hasLinkTemplate('canonical') && $entity->type && $entity->type->entity) {
For taxonomy terms the bundle key is `vid` and therefore we get the fatal error.
So the retrieval of the bundle entity it would need to be something like:
$entity->get($entity->getEntityType()->getKey('bundle'))->entity;
- Merge request !32Issue #3534423 by jonsimonsen, itmaybejj, szeidler: Error: Call to a member function bundle() on null β (Merged) created by szeidler
- π©πͺGermany szeidler Berlin
Here's a try for approaching the issue as a MR.
- πΊπΈUnited States itmaybejj
That looks good to me. Let me do some testing against some past edge cases before tagging a release.
- π³π΄Norway jonsimonsen
Version: 2.2.11 Β» 2.2.x-dev
Status: Active Β» Needs review
Here's a try for approaching the issue as a MR.I tested this in the project where I had issues. It did result in the taxonomy page rendering correctly, but I noticed an issue on a different page that was not there before the patch was applied.
The website encountered an unexpected error. Try again later.
Error: Call to a member function getEntityType() on null in editoria11y_page_attachments() (line 228 of modules/contrib/editoria11y/editoria11y.module).
Drupal\Core\Render\MainContent\HtmlRenderer->Drupal\Core\Render\MainContent\{closure}() (Line: 395)
Drupal\Core\Extension\ModuleHandler->invokeAllWith() (Line: 308)
Drupal\Core\Render\MainContent\HtmlRenderer->invokePageAttachmentHooks() (Line: 285)
Drupal\Core\Render\MainContent\HtmlRenderer->Drupal\Core\Render\MainContent\{closure}() (Line: 637)
Drupal\Core\Render\Renderer->executeInRenderContext() (Line: 284)
Drupal\Core\Render\MainContent\HtmlRenderer->prepare() (Line: 128)
Drupal\Core\Render\MainContent\HtmlRenderer->renderResponse() (Line: 90)
Drupal\Core\EventSubscriber\MainContentViewSubscriber->onViewRenderArray()
call_user_func() (Line: 111)
Drupal\Component\EventDispatcher\ContainerAwareEventDispatcher->dispatch() (Line: 186)
Symfony\Component\HttpKernel\HttpKernel->handleRaw() (Line: 76)
Symfony\Component\HttpKernel\HttpKernel->handle() (Line: 53)
Drupal\Core\StackMiddleware\Session->handle() (Line: 48)
Drupal\Core\StackMiddleware\KernelPreHandle->handle() (Line: 28)
Drupal\Core\StackMiddleware\ContentLength->handle() (Line: 116)
Drupal\page_cache\StackMiddleware\PageCache->pass() (Line: 90)
Drupal\page_cache\StackMiddleware\PageCache->handle() (Line: 48)
Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle() (Line: 51)
Drupal\Core\StackMiddleware\NegotiationMiddleware->handle() (Line: 36)
Drupal\Core\StackMiddleware\AjaxPageState->handle() (Line: 51)
Drupal\Core\StackMiddleware\StackedHttpKernel->handle() (Line: 741)
Drupal\Core\DrupalKernel->handle() (Line: 19) - πΊπΈUnited States itmaybejj
Updated MR !32. See if this works.
$entity_type = $entity && method_exists($entity, 'bundle') ? "Taxonomy: " . $entity->bundle() : 'Taxonomy term';
- π³π΄Norway jonsimonsen
The updated PR does indeed seem to work on both the taxonomy term pages and other pages I've tested. I'll do some more testing later when we have this deployed to our dev instance. Is there any module functionality I should test or is it enough to verify that all the pages load? I do see that the editoria11y UI elements appear and can be interacted with, but I'm not really familiar with all the options in the module since we only use it on a few projects that I know about
- πΊπΈUnited States itmaybejj
If it works on your project I'm satisfied. This basically removes all the new code in the PR and replaces it with a simple "If the bundle is missing a label just use this hard-coded string instead." I don't expect that to introduce regressions
- π³π΄Norway jonsimonsen
itmaybejj closed merge request !32
I thought this was supposed to be merged and possibly part of the next patch version. Did you perhaps make a mistake with the MR?
- π©πͺGermany szeidler Berlin
Setting it back to the previous state, because it seems that it hasn't been merged.
-
itmaybejj β
committed a12504a4 on 2.2.x authored by
szeidler β
Issue #3534423 by jonsimonsen, itmaybejj, szeidler: Error: Call to a...
-
itmaybejj β
committed a12504a4 on 2.2.x authored by
szeidler β
- πΊπΈUnited States itmaybejj
I've had...less embarrassing moments. 2.2.13 tagged β .
- π©πͺGermany szeidler Berlin
Happens to the best. Thanks for the quick follow up.