Install
Works with Drupal: ^11.2 || ^12Using Composer to manage Drupal site dependencies
Alternative installation files
Release notes
Compatibility:
Drupal 11.2 or later, and Drupal 12. Requires PHP 8.3+.
Tested on Drupal 11.2, 11.4 (PHP 8.4 and 8.5) and Drupal 12.0.0-beta2.
For Drupal 10.3+, use 1.0.x (1.0.9), which stays supported.
Upgrading from 1.0.x
- Make sure the site runs Drupal 11.2 or later.
- composer require 'drupal/layout_builder_block_copy:^2.0'
- Run drush updatedb (or visit /update.php), then clear caches.
If you already ran the repair update on 1.0.9, there's nothing more to run.
What's new in 2.0.0
- Drupal 12 ready: no deprecated APIs. Upgrade Status reports no issues.
- Modern code: hooks are attribute-based classes (#[Hook]), so the .module file is gone. Services and the controller use autowiring.
- New interface: BlockCopyManagerInterface, which you can inject by class name.
- Logging: a dedicated layout_builder_block_copy logger channel.
- hook_layout_builder_block_copy_access() lets other modules forbid copies, for example to enforce per-region block limits. See layout_builder_block_copy.api.php.
- README and help page.
Includes every 1.0.9 fix
- Copies of inline blocks are now cleaned up. They're saved only when the layout is saved, so Drupal tracks them and deletes them when they're removed from a layout or the page is deleted. Discarding a layout leaves nothing behind.
- Permission fix: copying an inline block creates block content, so it now requires Create and edit custom blocks, the same permission Layout Builder needs to add one. Other blocks can still be copied without it.
- Blocks whose content is missing are no longer copied. Before, they produced a broken block.
- Opening "Copy block" in a new tab now copies the block and returns to Layout Builder.
- Bundle classes: copies of block content types that use bundle classes now get their own content.
- Repair update: a database update records the missing tracking for inline blocks copied by older releases. It never deletes anything.
Breaking changes for developers (site builders aren't affected)
- Requirements: Drupal 10 and PHP below 8.3 are no longer supported.
- Manager service: layout_builder_block_copy.block_copy_manager now implements BlockCopyManagerInterface, and its constructor changed.
- Removed method: cleanupOrphanedComponent() is gone, because copies are no longer saved early.
- Exceptions: deepCloneComponent() throws BlockCopyException when an inline block's content can't be loaded.
- Hook function: layout_builder_block_copy_preprocess_block() no longer exists; the hook lives in a class.
Behavior change:
editors who lack Create and edit custom blocks can no longer copy inline blocks.