- Issue created by @finex
- 🇨🇦Canada Liam Morland Ontario, CA 🇨🇦
What is the patch that needs to be applied?
- 🇨🇦Canada Liam Morland Ontario, CA 🇨🇦
Unless I am misunderstanding something, this should be closed as duplicate of 🐛 Fatal error after updating to toc_api:^2 Active .
- 🇨🇦Canada joseph.olstad
We should close this when the upstream toc_filter patch is committed/resolved/fixed.
Automatically closed - issue fixed for 2 weeks with no activity.
- Status changed to Fixed
26 days ago 3:28pm 26 June 2025 - 🇨🇭Switzerland phma Basel, CH
I updated to the latest version of toc_filter, and I'm still getting the exact same error. Am I missing something?
TypeError: Drupal\toc_api\Plugin\Block\TocBlockBase::getCurrentToc(): Return value must be of type Drupal\toc_api\TocInterface, null returned in Drupal\toc_api\Plugin\Block\TocBlockBase->getCurrentToc() (line 109 of modules/contrib/toc_api/src/Plugin/Block/TocBlockBase.php). Drupal\toc_api\Plugin\Block\TocBlockBase->build() (Line: 106) Drupal\layout_builder\EventSubscriber\BlockComponentRenderArray->onBuildRender(Object, 'section_component.build.render_array', Object) call_user_func(Array, Object, 'section_component.build.render_array', Object) (Line: 111) Drupal\Component\EventDispatcher\ContainerAwareEventDispatcher->dispatch(Object, 'section_component.build.render_array') (Line: 90) Drupal\layout_builder\SectionComponent->toRenderArray(Array, 1) (Line: 88) Drupal\layout_builder\Section->toRenderArray(Array, 1) (Line: 228) Drupal\layout_builder\Element\LayoutBuilder->buildAdministrativeSection(Object, 0) (Line: 112) Drupal\layout_builder\Element\LayoutBuilder->layout(Object) (Line: 86) Drupal\layout_builder\Element\LayoutBuilder->preRender(Array) call_user_func_array(Array, Array) (Line: 113) Drupal\Core\Render\Renderer->doTrustedCallback(Array, Array, 'Render #pre_render callbacks must be methods of a class that implements \Drupal\Core\Security\TrustedCallbackInterface or be an anonymous function. The callback was %s. See https://www.drupal.org/node/2966725', 'exception', 'Drupal\Core\Render\Element\RenderCallbackInterface') (Line: 875) Drupal\Core\Render\Renderer->doCallback('#pre_render', Array, Array) (Line: 432) Drupal\Core\Render\Renderer->doRender(Array) (Line: 504) Drupal\Core\Render\Renderer->doRender(Array, ) (Line: 248) Drupal\Core\Render\Renderer->render(Array, ) (Line: 238) Drupal\Core\Render\MainContent\HtmlRenderer->Drupal\Core\Render\MainContent\{closure}() (Line: 638) Drupal\Core\Render\Renderer->executeInRenderContext(Object, Object) (Line: 231) Drupal\Core\Render\MainContent\HtmlRenderer->prepare(Array, Object, Object) (Line: 128) Drupal\Core\Render\MainContent\HtmlRenderer->renderResponse(Array, Object, Object) (Line: 90) Drupal\Core\EventSubscriber\MainContentViewSubscriber->onViewRenderArray(Object, 'kernel.view', Object) call_user_func(Array, Object, 'kernel.view', Object) (Line: 111) Drupal\Component\EventDispatcher\ContainerAwareEventDispatcher->dispatch(Object, 'kernel.view') (Line: 186) Symfony\Component\HttpKernel\HttpKernel->handleRaw(Object, 1) (Line: 76) Symfony\Component\HttpKernel\HttpKernel->handle(Object, 1, 1) (Line: 53) Drupal\Core\StackMiddleware\Session->handle(Object, 1, 1) (Line: 48) Drupal\Core\StackMiddleware\KernelPreHandle->handle(Object, 1, 1) (Line: 28) Drupal\Core\StackMiddleware\ContentLength->handle(Object, 1, 1) (Line: 32) Drupal\big_pipe\StackMiddleware\ContentLength->handle(Object, 1, 1) (Line: 116) Drupal\page_cache\StackMiddleware\PageCache->pass(Object, 1, 1) (Line: 90) Drupal\page_cache\StackMiddleware\PageCache->handle(Object, 1, 1) (Line: 48) Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle(Object, 1, 1) (Line: 51) Drupal\Core\StackMiddleware\NegotiationMiddleware->handle(Object, 1, 1) (Line: 36) Drupal\Core\StackMiddleware\AjaxPageState->handle(Object, 1, 1) (Line: 51) Drupal\Core\StackMiddleware\StackedHttpKernel->handle(Object, 1, 1) (Line: 741) Drupal\Core\DrupalKernel->handle(Object) (Line: 19)
- 🇨🇦Canada joseph.olstad
double check your composer.lock for
drupal/toc_filter:2.4
drush pml | grep toc
- 🇨🇭Switzerland phma Basel, CH
Correct me if I'm wrong, but I this seems to be a separate issue to #3518549
getToc
inTocManager.php
can return NULL. But this case isn't handled properly inTocBlockBase.php
./** * {@inheritdoc} */ public function getToc(string $id): ?TocInterface { return (isset($this->tocs[$id])) ? $this->tocs[$id] : NULL; }
I can create a patch, but should we reopen this issue, as it isn't really fixed in my opinion?
- 🇨🇭Switzerland phma Basel, CH
Correct me if I'm wrong, but I this seems to be a separate issue to 🐛 Fatal error after updating to toc_api:^2 Active
getToc
inTocManager.php
can return NULL. But this case isn't handled properly inTocBlockBase.php
./** * {@inheritdoc} */ public function getToc(string $id): ?TocInterface { return (isset($this->tocs[$id])) ? $this->tocs[$id] : NULL; }
I can create a patch, but should we reopen this issue, as it isn't really fixed in my opinion?
- 🇪🇸Spain fjgarlin
I agree that this is not the same as 🐛 Fatal error after updating to toc_api:^2 Active .
This issue belongs to this queue and. can be fixed as suggested in #14.
- @phma opened merge request.