Closed (fixed)
Project:
Generated Content
Version:
1.5.4
Component:
Code
Priority:
Normal
Category:
Feature request
Assigned:
Reporter:
Created:
9 Nov 2025 at 06:06 UTC
Updated:
31 Mar 2026 at 01:05 UTC
Jump to comment: Most recent
Instead of plain PHP, we should use Drupal plugins system.
Comments
Comment #3
alex.skrypnykBy: alex.skrypnyk
Summary
This pull request converts the generated content system from a hook-based architecture to a Drupal plugin-based system (#3556829). Generators are now discovered as PHP classes with a
#[GeneratedContent]attribute insrc/Plugin/GeneratedContent/directories.Key Changes
Core Infrastructure
GeneratedContentattribute class for marking generator plugins andGeneratedContentPluginManagerfor discovering and managing plugins.GeneratedContentPluginInterfaceandGeneratedContentPluginBaseto standardize plugin implementations with methods forgenerate(),getEntityType(),getBundle(),getWeight(), andgetTracking().plugin.manager.generated_contentservice ingenerated_content.services.yml.GeneratedContentRepositoryto use the plugin manager instead of scanning module hooks and loading.incfiles. RemovesModuleHandlerInterfaceandEntityTypeBundleInfoInterfacedependencies.GeneratedContentFormto guide users toward the plugin-based approach.Example Module Migrations
All hook-based generators in example modules (
generated_content_example1andgenerated_content_example2) are converted to plugin classes:Example 1:
generated_content_create_file_file,generated_content_create_media_image,generated_content_create_taxonomy_term_tags,generated_content_create_user_userFile,MediaImage,TaxonomyTermTags,UserExample 2:
generated_content_create_node_article,generated_content_create_node_page(with variations),generated_content_create_media_document,generated_content_create_taxonomy_term_tagsNodeArticle,NodePage(with variation support),MediaDocument,TaxonomyTermTagsRemoved Files
All procedural hook files have been deleted:
generated_content.api.php(main hook documentation).incfiles from example modules defining weight, tracking, and creation hooksRuntime Plugin Alteration
Support for
hook_generated_content_plugin_alter()is now documented, enabling runtime modification of plugin definitions.Migration Impact
This change represents a significant architectural shift from hook-based to plugin-based content generation, aligning with modern Drupal practices. All existing generators must be refactored as plugin classes to continue functioning.