BlockComponent::checkRequirements() should disallow any block plugins whose definition declares it requires certain contexts

Created on 22 April 2025, 24 days ago

Overview

Until πŸ“Œ Handle block contexts Active is done, XB won't pass contexts to block plugins.

… but \Drupal\experience_builder\Plugin\ExperienceBuilder\ComponentSource\BlockComponent::checkRequirements() does not yet check that!

This means XB users may be placing block components that don't actually work as expected, which will certainly result in bug reports.

Proposed resolution

  1. Add a block plugin to the xb_test_block module with optional contexts
  2. Add a block plugin to the xb_test_block module with required contexts
  3. … and whichever other permutations may exist
  4. Update BlockComponent::checkRequirements() to disallow contexts (or required contexts only?) β€” requires investigating how block plugins actually use these
  5. Update \Drupal\Tests\experience_builder\Kernel\Plugin\ExperienceBuilder\ComponentSource\BlockComponentTest::testDiscovery() expectations

User interface changes

/admin/appearance/component/status will start saying that some blocks use contexts, and are hence excluded from use in XB.

πŸ“Œ Task
Status

Active

Version

0.0

Component

Component sources

Created by

πŸ‡§πŸ‡ͺBelgium wim leers Ghent πŸ‡§πŸ‡ͺπŸ‡ͺπŸ‡Ί

Live updates comments and jobs are added and updated live.
  • Needs tests

    The change is currently missing an automated test that fails when run with the original code, and succeeds when the bug has been fixed.

Sign in to follow issues

Merge Requests

Comments & Activities

Production build 0.71.5 2024