Replicate UI
Provides a user interface for the Replicate module, enabling content duplication through local tasks, entity operations, and bulk actions.
replicate_ui
Install
composer require 'drupal/replicate_ui:8.x-1.2'
composer require 'drupal/replicate_ui:8.x-1.1'
composer require 'drupal/replicate_ui:8.x-1.0'
Overview
Replicate UI bridges the gap between the Replicate API module and end users by providing intuitive user interface elements for duplicating content entities. When enabled, this module adds a 'Replicate' tab to entity pages, a 'Replicate' option in entity operations dropdowns, and action plugins that integrate with Views Bulk Operations.
The module features a confirmation form that allows users to customize the label of the duplicated entity before creation, with full support for multilingual content where each translation can have its own customized label. Access control is handled through a dedicated permission combined with the entity's create access, ensuring users can only replicate content they're authorized to create.
Site administrators can selectively enable replication for specific content entity types through a configuration page, and optionally require that users have edit access to the original entity before allowing duplication.
Features
- Adds a 'Replicate' local task (tab) to entity view pages for enabled entity types
- Confirmation form with customizable label for the replicated entity, supporting '(Copy)' suffix by default
- Full multilingual support allowing separate label customization for each translation
- Entity operations integration showing 'Replicate' in entity list dropdowns (e.g., Content admin page)
- Action plugin for integration with Views Bulk Operations (VBO) allowing batch replication
- Rules module integration with a 'Replicate entity' action for workflow automation
- Views field plugin providing a 'Replicate' link for any entity-based View
- Configurable per-entity-type enabling - only enable replication for entity types you need
- Optional edit access checking to prevent users from replicating content they cannot edit
- Automatic admin route detection inheriting admin theme usage from entity edit routes
Use Cases
Creating content variations quickly
Content editors frequently need to create similar content with minor variations. Instead of creating from scratch, they can replicate an existing node, change the title to reflect the new content, and then edit specific fields. This is particularly useful for product pages, event announcements, or news articles with similar structures.
Batch content duplication with VBO
Site administrators managing large content migrations or reorganizations can select multiple items in a View and use the 'Replicate' bulk action to create copies of all selected entities at once. This is useful when creating content across multiple sections or preparing content for different audiences.
Template-based content creation
Organizations can create 'template' nodes or entities that serve as starting points for new content. Authors select the template, click Replicate, give it a new name, and fill in the specifics. This ensures consistency in structure and required fields across similar content types.
Automated content workflows with Rules
Using the Rules integration, sites can automatically replicate entities based on triggers. For example, when a product is marked as 'seasonal', automatically create a copy in a different category, or when an event passes, create a template for next year's event.
Multilingual content preparation
When replicating content that has multiple translations, editors can customize the title for each language version directly in the confirmation form. This streamlines the process of creating translated content variants without losing any existing translations.
Tips
- Enable replication only for entity types that actually need it to keep entity operation menus clean and reduce unnecessary routes.
- Consider using the 'Check original entity edit access' option in high-security environments to prevent users from replicating content they cannot modify.
- The replicated entity is not saved automatically - users are redirected to the new entity's view page after creation, allowing immediate editing if needed.
- When using with multilingual content, all translations are automatically replicated, and each can have a custom label set during the confirmation step.
- The Replicate link in Views can be combined with Views Bulk Operations for maximum flexibility in content management workflows.
- For programmatic replication without UI, use the base Replicate module's replicator service directly: \Drupal::service('replicate.replicator')->replicateEntity($entity)
Technical Details
Admin Pages 1
/admin/config/content/replicate
Configure which content entity types should support the replication/duplication feature. Only enabled entity types will show the Replicate tab and operations.
Permissions 1
Hooks 3
hook_entity_type_build
Adds the 'replicate' form class and link template to enabled content entity types. This allows the entity system to recognize the replicate form handler.
hook_entity_operation
Adds a 'Replicate' operation to entity operations dropdowns for entities that support replication and have the appropriate link template.
hook_help
Provides help text on the module's help page explaining the supported integrations including nodes, Views, VBO, Rules, and Field Collection.
Troubleshooting 4
Check that: 1) The entity type is enabled in /admin/config/content/replicate, 2) The current user has the 'Replicate entities via UI' permission, 3) The user has 'create' access for the entity type, 4) Clear all caches after enabling an entity type.
The user needs both the 'replicate entities' permission AND create access for the entity type. If 'Check original entity edit access' is enabled in settings, the user also needs update access to the original entity.
Ensure the entity type displayed in the View is enabled for replication in the module settings. Clear caches after making configuration changes. The action appears as 'Replicate [Entity Type]' in the actions list.
The module rebuilds routes when configuration is saved. If routes are still missing, manually rebuild with 'drush cr' or by visiting /admin/config/development/performance and clearing caches.
Security Notes 4
- Access to replication requires both the 'replicate entities' permission and entity create access - one without the other is insufficient.
- The optional 'check edit access' setting provides an additional security layer by requiring update permission on the source entity.
- Replicated entities inherit field values but are created as new entities with new IDs - they do not inherit revision history or moderation states.
- Content moderators should be aware that replicated content may bypass moderation workflows depending on the entity type's configuration.