Error: Call to a member function access() on null in Drupal\block\BlockAccessControlHandler->checkAccess() (line 124 of core/modules/block/src/BlockAccessControlHandler.php).

Created on 26 June 2023, over 1 year ago
Updated 27 December 2023, 11 months ago

Problem/Motivation

After placing the block and clearing the cache, the page reports:
Error: Call to a member function access() on null in Drupal\block\BlockAccessControlHandler->checkAccess() (line 124 of core/modules/block/src/BlockAccessControlHandler.php).

When re-importing the configuration without provider, the drush configuration import (cex) complains:

The "views_exposed_filter_blocks_block" was not found

The reason seems to be, that plugin in the config is being detected as null, while it should be views_exposed_filter_blocks:

uuid: 524a114b-6c8a-4efa-a245-1b7742958d14
langcode: de
status: true
dependencies:
  module:
    - fences_block
    - views_exposed_filter_blocks
  theme:
    - drowl_child
third_party_settings:
  fences_block:
    fences:
      sections:
        wrapper:
          element: ''
          classes: ''
        label:
          element: ''
          classes: ''
        content:
          element: ''
          classes: ''
id: my_example_theme_search
theme: my_example_theme
region: footer_cta
weight: 0
provider: views_exposed_filter_blocks
plugin: null
settings:
  id: views_exposed_filter_blocks_block
  label: 'Nicht gefunden, was Sie suchen?'
  label_display: visible
  provider: views_exposed_filter_blocks
  view_display: 'zmp_search:page_search'
visibility: {  }

Steps to reproduce

Proposed resolution

Changing the config like this, resolves the issue:

uuid: 524a114b-6c8a-4efa-a245-1b7742958d14
langcode: de
status: true
dependencies:
  module:
    - fences_block
    - views_exposed_filter_blocks
  theme:
    - drowl_child
third_party_settings:
  fences_block:
    fences:
      sections:
        wrapper:
          element: ''
          classes: ''
        label:
          element: ''
          classes: ''
        content:
          element: ''
          classes: ''
id: my_example_theme_search
theme: my_example_theme
region: footer_cta
weight: 0
provider: views_exposed_filter_blocks
plugin: views_exposed_filter_blocks_block
settings:
  id: views_exposed_filter_blocks_block
  label: 'Nicht gefunden, was Sie suchen?'
  label_display: visible
  provider: views_exposed_filter_blocks
  view_display: 'zmp_search:page_search'
visibility: {  }

(with provider: views_exposed_filter_blocks) and the block works as expected.

But the question is, why the plugin isn't being detected correctly. I already compared the implementation in the module to https://www.drupal.org/docs/creating-modules/creating-custom-blocks/crea... β†’ and can't find a mistake.

Remaining tasks

User interface changes

API changes

Data model changes

πŸ› Bug report
Status

Active

Version

1.0

Component

Code

Created by

πŸ‡©πŸ‡ͺGermany Anybody Porta Westfalica

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

Comments & Activities

Production build 0.71.5 2024