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 own PdbBlock. On render, attaches pdb_angular_entity/pdb.angular.runtime, writes a per-instance drupalSettings.pdb.angular[uuid] entry with module_path, development_mode, and any resolved component properties.
  • PdbAngularBlockDeriver — iterates PDB's component discovery and derives one block definition per presentation: angular component. Block labels come from the component's name key in its .info.yml.
  • development_mode — boolean in pdb_angular_entity.settings (admin form checkbox, defaults true). 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 PdbBlock is 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_angular is also installed alongside pdb_angular_entity
  • Merge to 1.0.x and tag 1.1.0 (or include in a future 1.x stable) 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

keboca created an issue. See original summary.

keboca’s picture

Shipped 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.

keboca’s picture

Status: Active » Fixed

Now that this issue is closed, review the contribution record.

As a contributor, attribute any organization that helped you, or if you volunteered your own time.

Maintainers, credit people who helped resolve this issue.