Missing "entity" context breaks layout builder-related admin interfaces

Created on 4 February 2025, 2 months ago

Problem/Motivation

While trying to test the Umami demo with this module, I encountered errors at 2 places related to the layout builder:

<ul>
  <li>/en/admin/config/user-interface/navigation-block</li>
  <li>/en/admin/structure/types/manage/recipe/display
</ul>

They are almost same:

Drupal\Component\Plugin\Exception\ContextException: The entity context is not a valid context. in Drupal\layout_builder\Plugin\SectionStorage\SectionStorageBase->getContextDefinition() (line 150 of /app/web/core/lib/Drupal/Core/Plugin/ContextAwarePluginTrait.php).

The cause seems to be that code at https://git.drupalcode.org/project/navigation_plus/-/blob/1.0.x/src/Navi... assumes that layout builder is used for overriding layout of a content entity (for comparison, see https://www.drupal.org/project/layout_builder_perms/issues/3392780 πŸ› Drupal\Component\Plugin\Exception\ContextException: The entity context is not a valid context. Active ).

I managed to access those configuration interfaces with

          try {
            $entity = $parameter->getContextValue('entity');
          } catch (ContextException $e) {
            $entity = NULL;
          }

Steps to reproduce

I tried to follow installation instructions as mentioned on the project page.

πŸ› Bug report
Status

Active

Version

1.0

Component

Code

Created by

πŸ‡¨πŸ‡ΏCzech Republic milos.kroulik

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Production build 0.71.5 2024