Problem/Motivation

I'm testing the module and it seems very good to me, it meets what I need but I was doing tests to use it in the layout builder but I see that it gives me this problem

The website encountered an unexpected error. Try again later.
TypeError: strlen(): Argument #1 ($string) must be of type string, array given in strlen() (line 395 of core/lib/Drupal/Component/Utility/Unicode.php).
Drupal\Component\Utility\Unicode::validateUtf8() (Line: 65)
Drupal\Component\Utility\Xss::filter() (Line: 398)
Drupal\toc_ng\Plugin\Block\TocNgBlock->buildToc() (Line: 435)
Drupal\toc_ng\Plugin\Block\TocNgBlock->build() (Line: 106)
Drupal\layout_builder\EventSubscriber\BlockComponentRenderArray->onBuildRender()
call_user_func() (Line: 111)
Drupal\Component\EventDispatcher\ContainerAwareEventDispatcher->dispatch() (Line: 90)
Drupal\layout_builder\SectionComponent->toRenderArray() (Line: 88)
Drupal\layout_builder\Section->toRenderArray() (Line: 228)
Drupal\layout_builder\Element\LayoutBuilder->buildAdministrativeSection() (Line: 112)
Drupal\layout_builder\Element\LayoutBuilder->layout() (Line: 86)
Drupal\layout_builder\Element\LayoutBuilder->preRender()
call_user_func_array() (Line: 111)
Drupal\Core\Render\Renderer->doTrustedCallback() (Line: 859)
Drupal\Core\Render\Renderer->doCallback() (Line: 421)
Drupal\Core\Render\Renderer->doRender() (Line: 493)
Drupal\Core\Render\Renderer->doRender() (Line: 240)
Drupal\Core\Render\Renderer->render() (Line: 238)
Drupal\Core\Render\MainContent\HtmlRenderer->Drupal\Core\Render\MainContent\{closure}() (Line: 627)
Drupal\Core\Render\Renderer->executeInRenderContext() (Line: 239)
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: 58)
Drupal\Core\StackMiddleware\Session->handle() (Line: 48)
Drupal\Core\StackMiddleware\KernelPreHandle->handle() (Line: 28)
Drupal\Core\StackMiddleware\ContentLength->handle() (Line: 32)
Drupal\big_pipe\StackMiddleware\ContentLength->handle() (Line: 106)
Drupal\page_cache\StackMiddleware\PageCache->pass() (Line: 85)
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: 704)
Drupal\Core\DrupalKernel->handle() (Line: 19)

Steps to reproduce

- create a content type
- activate layout builder and use toc ng block

with that reproduce the error

Issue fork toc_ng-3463846

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

Nelo_Drup created an issue. See original summary.

mably’s picture

Hello, thanks for reporting the problem,.

Could you apply the provided patch on the dev branch and tell me how it goes?

If it fixes the problem, I'll merge it.

mably’s picture

Merge request created.

mably’s picture

Status: Active » Needs review
mably’s picture

StatusFileSize
new3.14 KB

Patch has been replaced.

nelo_drup’s picture

#6 Thanks @mably, I just installed it and it works very well.

  • mably committed 3eac3eec on 1.0.x
    Issue #3463846 by mably, Nelo_Drup: Error if use with layout builder
    
mably’s picture

mably’s picture

Status: Needs review » Fixed

New version 1.0.0-beta2 including the fix has been released.

Status: Fixed » Closed (fixed)

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