Problem/Motivation
The main module handled all entity types (nodes, taxonomy terms, custom URLs)
in a single monolithic settings form (MicrowaveSettingsForm) and
a single flattened configuration object (microwave.settings).
Commerce product support was provided by microwave_commerce,
which used a hook_form_alter to inject its configuration section
into the main form by directly manipulating the form array structure. This
created tight coupling between sub-modules and the main module's internal form
structure, making the architecture brittle and hard to extend cleanly.
Adding support for a new entity type required changes to the main module itself.
Steps to reproduce
N/A — this is a refactoring issue with no bug to reproduce.
Proposed resolution
Adopt a sub-module architecture with attribute-based auto-discovered entity
warmer plugins, similar to the approach used in the index_now
module.
-
Introduce an
EntityWarmerManagerthat auto-discovers plugins
using a PHP 8 attribute (#[WarmableEntity]) from
Plugin/EntityWarmer/directories across all enabled modules. -
Define an
EntityWarmerInterfaceand an
AbstractEntityWarmerbase class providing shared logic (entity
querying, date filtering, queue item building). -
Split entity type support into dedicated sub-modules
(microwave_node,microwave_taxonomy,
microwave_commerce_product), each containing only a plugin
class, a config schema, and a default configuration file. -
Rebuild the main settings form dynamically from discovered plugins. Each
plugin provides its own configuration section — no more form alters. -
Replace the previous per-entity-type Drush commands
(microwave:process_nodes_urls,
microwave:process_terms_urls,
microwave:process_commerce_product_urls) with a single unified
commandmicrowave:process_entity_urls(aliasmpeu)
that iterates over all discovered entity warmer plugins. -
Keep the queue-based async warming architecture intact; only the entity
registration and configuration layers are refactored. -
Handle custom URL warming via a dedicated service / queue worker, outside
of the entity plugin system.
Remaining tasks
- ~~Design and implement
EntityWarmerInterfaceandAbstractEntityWarmer~~ ✓ - ~~Implement
EntityWarmerManagerwith attribute-based discovery~~ ✓ - ~~Create
microwave_nodesub-module withNodeWarmerplugin~~ ✓ - ~~Create
microwave_taxonomysub-module withTermWarmerplugin~~ ✓ - ~~Create
microwave_commerce_productsub-module withCommerceProductWarmerplugin~~ ✓ - ~~Refactor
MicrowaveSettingsFormto build dynamically from discovered plugins~~ ✓ - ~~Define per-sub-module config schema and default config files~~ ✓
- ~~Handle custom URL warming outside of the entity plugin system~~ ✓
- ~~Update Drush commands~~ ✓
- ~~Update README~~ ✓
- Write a migration path / update hook for existing
microwave.settingsconfiguration
User interface changes
The settings form is now restructured: instead of a static form partially
built via form alters, it renders one section per discovered warmer plugin.
The visible configuration options remain the same; only the form structure
changed.
API changes
New plugin system introduced: EntityWarmerInterface,
AbstractEntityWarmer, EntityWarmerManager, and the
#[WarmableEntity] attribute. Third-party modules can register a
new warmable entity type by placing a class in their
Plugin/EntityWarmer/ subdirectory — no hooks, services, or form
alters needed.
Drush: the per-entity-type commands have been removed and replaced by the
unified drush microwave:process_entity_urls (drush mpeu).
Data model changes
Configuration is split from the single microwave.settings object
into separate per-sub-module config objects (microwave_node.settings,
microwave_taxonomy.settings,
microwave_commerce_product.settings). An update hook is still
needed to migrate existing site configuration.
Issue fork microwave-3588489
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
Comments
Comment #3
macsim commentedComment #4
macsim commentedComment #5
macsim commentedComment #6
macsim commentedComment #8
macsim commentedComment #10
macsim commented