Problem/Motivation

When we try to add Tocify block in Layout Builder interface, after cllick by Add block button, nothing happens. And in DB log we can see next message:

Message TypeError: Argument 1 passed to Drupal\Core\Plugin\ContextAwarePluginBase::createContextFromConfiguration() must be of the type array, string given, called in /var/www/docroot/core/lib/Drupal/Component/Plugin/ContextAwarePluginBase.php on line 58 in Drupal\Core\Plugin\ContextAwarePluginBase->createContextFromConfiguration() (line 30 of /var/www/docroot/core/lib/Drupal/Core/Plugin/ContextAwarePluginBase.php)

Steps to reproduce

  1. Log as admin
  2. Go to edit layout for node with enabled Layout Builder
  3. Click by add Table of contents block in LB UI
  4. Click Add block button
  5. Verify that block doen't add
  6. Go to DBlog (/admin/reports/dblog/)
  7. Verify that you can see the message that I've added above

Proposed resolution

Needs to provide a patch

CommentFileSizeAuthor
#2 3225108.patch2.42 KBaleevas

Comments

aleevas created an issue. See original summary.

aleevas’s picture

Assigned: aleevas » Unassigned
Status: Active » Needs review
StatusFileSize
new2.42 KB

So the issue was in confused name of one option "context".
This name of config is reserved by LB. And ContextAwarePluginBase::createContextFromConfiguration() expect an array, but got a string from block settings.
I've added a patch in that I just rename this option to container in block settings. That solve issue.
Hope it will be helpfull for someone

  • sanduhrs committed 8f3e4b8 on 8.x-2.x authored by aleevas
    Issue #3225108 by aleevas: Not abble to add tocify block in Layout...
sanduhrs’s picture

Status: Needs review » Fixed

Thanks for the patch!

Status: Fixed » Closed (fixed)

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