Error: Call to a member function getThirdPartySetting() on null

Created on 15 June 2025, 18 days ago

Problem/motivation

When attempting to move a block within Layout Builder for a dashboard entity provided by the Dashboard module , a fatal error occurs because the dashboard entity does not utilise an Entity View Display. Layout Builder Restrictions expects a valid view display to be available. Since dashboards do not define or use view modes or view displays by default, the method blockAllowedinContext() receives a NULL value, causing a fatal error:

Error: Call to a member function getThirdPartySetting() on null in EntityViewModeRestriction->blockAllowedinContext()

This makes it impossible to move blocks in the dashboard layout when Layout Builder Restrictions is enabled.

Steps to reproduce

  1. Enable the dashboard, layout_builder, and layout_builder_restrictions modules.
  2. Create a new dashboard.
  3. Go to the layout builder UI for the created dashboard.
  4. Try to move an existing block.
  5. Observe that a fatal error is thrown and the layout breaks.

Proposed resolution

Add a null check inside EntityViewModeRestriction::blockAllowedinContext() to skip restrictions if no view display is available.

This module uses Gitlab CI for automated testing of proposed code changes. To contribute code changes, create a merge request. Patch files will not trigger automated testing and are not sufficient for review.
🐛 Bug report
Status

Active

Version

3.0

Component

Code

Created by

🇯🇴Jordan n.ghunaim Amman - Jordan

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

Comments & Activities

Production build 0.71.5 2024