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 EntityWarmerManager that auto-discovers plugins
    using a PHP 8 attribute (#[WarmableEntity]) from
    Plugin/EntityWarmer/ directories across all enabled modules.
  • Define an EntityWarmerInterface and an
    AbstractEntityWarmer base 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
    command microwave:process_entity_urls (alias mpeu)
    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 EntityWarmerInterface and AbstractEntityWarmer~~ ✓
  • ~~Implement EntityWarmerManager with attribute-based discovery~~ ✓
  • ~~Create microwave_node sub-module with NodeWarmer plugin~~ ✓
  • ~~Create microwave_taxonomy sub-module with TermWarmer plugin~~ ✓
  • ~~Create microwave_commerce_product sub-module with CommerceProductWarmer plugin~~ ✓
  • ~~Refactor MicrowaveSettingsForm to 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.settings configuration

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

Command icon 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

macsim created an issue. See original summary.

macsim’s picture

Assigned: macsim » adelgado12
Status: Active » Needs review
macsim’s picture

Issue summary: View changes
macsim’s picture

Assigned: adelgado12 » macsim
Status: Needs review » Needs work
macsim’s picture

Issue summary: View changes

  • macsim committed 34b2c38e on 2.0.x
    fix: #3588489 Refactor: introduce sub-module architecture with auto-...
macsim’s picture

Assigned: macsim » Unassigned
Issue summary: View changes
Status: Needs work » 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.

macsim’s picture

Status: Fixed » Closed (fixed)