Install
Works with Drupal: ^11.2 || ^12Using Composer to manage Drupal site dependencies
Alternative installation files
Download tar.gz
45.98 KB
MD5: 5f18106b89995a8702b9c1d071658396
SHA-1: 855073a21165958424a711fde635498b9e671923
SHA-256: 89afc3591cc943b09dcb99e5ca5f947bb2470dbedec6514fc2a30812003bfc23
Download zip
73.4 KB
MD5: 1ae7757934e55082033993fbc726b813
SHA-1: 1fec671db7e1cfedede57cc4e9766e344ecfbfe4
SHA-256: d2ca989de3d53db814e9d4ad2192481b78dfad2fabf2e329287dbb0c59ea186b
Release notes
Layout Builder Block Copy 2.0.1
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 the 1.x branch.
Upgrading
- From 2.0.0: update the code and clear caches (
drush cr). No database updates are needed. - From 1.0.x: make sure the site runs Drupal 11.2 or later, run
composer require 'drupal/layout_builder_block_copy:^2.0', then rundrush updatedb.
Fixes
- Copying blocks with paragraphs: copying an inline block that wasn't saved yet (for example a fresh copy, or a block edited in Layout Builder) failed with "The website encountered an unexpected error" when it held paragraphs. It now works, and every copy gets its own paragraphs.
- Copy link and permissions: the link is now checked against the layout you're editing, including unsaved changes. Editors without Create and edit custom blocks no longer see a "Copy block" link on new or copied inline blocks that then refuses to work.
- Layout Builder Lock: blocks can no longer be copied into a section locked against adding blocks, or into a locked region. The lock module's bypass permissions still apply.
- Clones and blocks created in code: copies placed into a new entity, such as a cloned node, are now properly tracked. Drupal cleans them up when the entity is deleted, and they're accessible outside Layout Builder.
- Broken blocks: placements of blocks that were deleted or are no longer reusable aren't copied. Editors see "This block is broken or its content is missing, so it cannot be copied."
- Outdated copy links: if a block was removed meanwhile, for example in another tab, editors are asked to reload the page instead of getting an error.
- Errors: unexpected errors while copying are logged and shown as a message instead of ending the request with an error page.
- Position: copies keep their position when other modules copy blocks in code.
Repair command (new)
drush layout-builder-block-copy:repair-usage checks the usage tracking of every current layout. You can run it at any time, for example after restoring an older database. It does three things:
- records usage for inline blocks that have none
- assigns usage rows that have no owner to the layout that uses the block, so cron can't delete blocks that are still in use
- reports blocks whose usage names a layout that no longer uses them
Options:
--dry-runshows what would change without changing anything.--reown-defaultsassigns blocks of default layouts back to their display.
It never deletes anything.
For developers
- New:
BlockCopyManagerInterface::claimNewEntityUsage(), for code that writes layouts without saving the entity through the entity API. deepCloneComponent()now keeps the original component's weight. It throwsBlockCopyExceptionfor placements of blocks that no longer exist.hook_layout_builder_block_copy_access()now receives the unsaved layout.- Tests now ship with the module: unit, kernel and functional, 86 in all. The tests for Paragraphs and Layout Builder Lock are skipped where those modules aren't installed.
Behavior changes
- Copying into sections or regions locked by Layout Builder Lock is now refused, unless the user has the lock module's bypass permission.