Problem/Motivation
Currently, pdb_angular_entity components can only be rendered through an entity view display — a content type must have a field configured with the "Angular Component" view mode. This means Angular components that don't depend on entity data (e.g. a site-wide header widget, a standalone search component, or a nav enhancement) have no supported placement path.
Proposed resolution
Introduce a block plugin that exposes every PDB-discovered presentation: angular component as a placeable Drupal block. Implemented on 1.x-dev:
PdbAngularBlock— extends PDB's ownPdbBlock. On render, attachespdb_angular_entity/pdb.angular.runtime, writes a per-instancedrupalSettings.pdb.angular[uuid]entry withmodule_path,development_mode, and any resolved component properties.PdbAngularBlockDeriver— iterates PDB's component discovery and derives one block definition perpresentation: angularcomponent. Block labels come from the component'snamekey in its.info.yml.development_mode— boolean inpdb_angular_entity.settings(admin form checkbox, defaultstrue). When enabled, the Angular runtime logs a[PDB Angular]console group per instance with element, module path, and resolved properties. Works for both entity display and block render paths.
Live-tested on a Drupal 10 site: site_info_component (a standalone Angular component with no entity dependency) renders correctly as a block, reading site_name from drupalSettings. article_component bootstraps correctly as a block and degrades gracefully when placed outside of a node page context.
Remaining tasks
- Community review of the block plugin approach — particularly whether extending
PdbBlockis the right base class or whether a more decoupled approach is preferred - Review of
PdbAngularBlockDeriver— confirm it aligns with how other PDB submodules handle component discovery - Testing on sites with multiple Angular components and custom
configuration:keys in.info.yml - Confirm behavior when
pdb_angularis also installed alongsidepdb_angular_entity - Merge to
1.0.xand tag1.1.0(or include in a future1.xstable) once feedback is addressed
User interface changes
Each discovered Angular component appears as a placeable block in Structure → Block layout. Block label is the component's name from its .info.yml. A "Development mode" checkbox is added to the PDB Angular Entity settings form (/admin/config/pdb/angular-entity).
API changes
No changes to existing APIs. Adds two new classes: Drupal\pdb_angular_entity\Plugin\Block\PdbAngularBlock and Drupal\pdb_angular_entity\Plugin\Derivative\PdbAngularBlockDeriver.
Data model changes
Adds development_mode boolean to pdb_angular_entity.settings config object. Config schema updated accordingly. No database schema changes.
Comments
Comment #2
keboca commentedShipped in 1.1.0 — the block plugin, deriver, and development mode are now available on the stable release.
composer require drupal/pdb_angular_entity:^1.1
Closing this as fixed. Further hardening (service injection, render arrays) is tracked separately and will land in the next release.
Comment #3
keboca commented