Install
Works with Drupal: ^10 || ^11Using Composer to manage Drupal site dependencies
Alternative installation files
Download tar.gz
11.16 KB
MD5: 3f94063185edb088e8a22f324b4f5961
SHA-1: c711af31b1894573a0b740bd8a0362a1e43193cc
SHA-256: 4b1de6bd515ac9fe48dee5b8588a9e110b40fb21d0c5ca57ce4aafbd10895733
Download zip
13.13 KB
MD5: fa8e20ee38bf9b877bd96324e84ce791
SHA-1: 22dc8f73a301c805e53807a3663219b252005f1a
SHA-256: 06d212f48a587d24ade7f44b2d79ce2f50df5b9a53c74840d1a817a721723906
Release notes
Breaking changes
- Dropped support for Drupal 8 and 9. This release requires Drupal 10 or 11 (PHP 8.1+).
- Added
EntityTypeManagerInterfaceas a new constructor dependency. If you extendBlockPluginViewBuilder, update your subclass constructor accordingly.
New features
-
Context-aware block support. You can now pass explicit contexts to
view()andviewPlugin(), enabling rendering of block plugins that require contexts (e.g. a node or user entity). Previously, context-aware blocks could not be rendered through this module.
use Drupal\Core\Plugin\Context\Context; use Drupal\Core\Plugin\Context\EntityContextDefinition; $build = $blockPluginViewBuilder->view('plugin_id', [], [ 'node' => new Context(new EntityContextDefinition('entity:node'), $node), ]);Supported context types:
- Entity contexts (
entity:node,entity:user, etc.) — stored as entity type + ID and reloaded safely in the lazy builder. - Scalar contexts (
string,integer, etc.) — passed through as-is via JSON.
- Entity contexts (
Security
- Removed use of PHP
serialize()/unserialize()which was present in a community-contributed context-passing implementation. Context data is now encoded using only JSON with safe scalar identifiers, eliminating the PHP object injection risk.
Bug fixes
- Fixed PHPStan errors related to
json_encode()return type, nullable request/route in title block handling, and a redundant null check onBlockPluginInterface::build(). - Title blocks now gracefully fall back to lazy building when the request or route object is unavailable, instead of triggering a type error.