Problem/Motivation
The removal of reusable block support (commit dff037f, tracked in #3516918: Remove Reusable Block Support)
was committed to the 9.1.x branch without migration tooling, creating two
problems for sites upgrading from 9.1.1 or 9.1.2 tagged releases:
- Update hook hazard:
patternkit_update_10308throws
UpdateExceptionwhen it encounters reusable block placements whose derivative
loader has been removed, haltingdrush updbfor affected 9.1.1 sites. - No migration tooling: The removal preserved entity data but provided
no automated path for converting reusable block placements to inline equivalents. Entity
data is preserved but orphaned — placements render as Drupal’s
brokenblock.
The deprecation change record (#3517440) states removal in
9.3.0, which is a typo — the code-level @Deprecated
annotations target 9.2.0. The change record needs correction regardless of
this issue.
Steps to reproduce
- Install Patternkit 9.1.1 and enable reusable blocks
(enable_reusable_blocks: truein
patternkit.services.yml). - Place a reusable Patternkit block at the site level via
admin/structure/block. - Upgrade to the current
9.1.x-dev(post-dff037f). - Run
drush updb. - Observe:
patternkit_update_10308throws
UpdateExceptionbecause$block->getPlugin()returns
core’sbrokenplugin (the derivative loader for UUID-based reusable
blocks was removed).
Proposed resolution
Revert commit dff037f to reintroduce the deprecated reusable block code for
the 9.1.3 release. This provides a migration window for sites with existing reusable block
content before the committed removal in 9.2.0.
1. Revert dff037f — restores 24 files: derivative
loader, ReusableBlockHooks, deprecation warnings,
patternkit_requirements(), block form elements, and associated tests. The revert
applies cleanly with zero merge conflicts.
2. Guard patternkit_update_10308 — change the
instanceof check from throwing UpdateException to logging a warning
and continuing.
3. No-op patternkit_update_10309 — prevent the
premature drop of the reusable column. The column should not be removed until
the actual removal release (9.2.0).
4. Verify deprecation annotations — ensure all
@Deprecated and @trigger_deprecation annotations consistently
reference 9.2.0 as the removal version.
The reintroduced code is disabled by default
(enable_reusable_blocks: false in patternkit.services.yml). Sites
must explicitly enable it.
Change record updates:
- #3517440: Correct the removal target from
9.3.0(typo)
to9.2.0. Add a note that 9.1.3 reintroduces the deprecated code as a
migration window. - New change record for 9.1.3: Document the deprecation-with-window
approach: reusable blocks are deprecated and disabled by default, migration window
provided before 9.2.0 removal.
Remaining tasks
- Revert
dff037f. - Implement
patternkit_update_10308guard. - No-op
patternkit_update_10309. - Verify deprecation annotations reference
9.2.0. - Update change record #3517440.
- Publish new 9.1.3 change record.
- Review and test the merge request.
- CI validation.
User interface changes
The reusable block checkbox and deprecation warnings in the block configuration form are
restored for sites that enable enable_reusable_blocks: true. No visible change
for sites using the default (disabled) configuration.
API changes
The PatternkitBlock derivative loader restores UUID-based derivative
definitions for reusable block entities. All restored code carries
@Deprecated annotations targeting removal in 9.2.0.
Data model changes
The reusable column on the patternkit_block entity is retained
(the premature drop in patternkit_update_10309 is converted to a no-op). The
column will be dropped in the 9.2.0 removal release.
Release notes snippet
Deprecated reusable block support has been reintroduced in 9.1.3 to provide a migration
window for sites with existing reusable block content. The feature is disabled by default.
Sites that previously enabled reusable blocks should use this window to migrate content to
inline block placements before the committed removal in 9.2.0, which will include
automated migration tooling.
Issue fork patternkit-3587714
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
Comment #3
sluceroMR !190 is open against
9.1.xand ready for review.The branch contains four commits:
patternkit_update_10308/10309/10310update hooks,ReusableBlockHooks::requirements()deprecation warning)CoversFunctionattribute target, CSpell dictionary, PHPStan baseline version-tolerance)Comment #4
sluceroReviewed and tested internally. Rebased and queued for merge into the release branch.
Comment #6
sluceroThis has now been merged in for inclusion in the 9.1.3 release.
See #3542304: Patternkit 9.1.3 Release Plan.
Comment #8
sluceroThis MR included the resolution for #3604089: Drupal 11.4 compatibility: adapt PatternLibraryParserBase for YamlCacheCollector constructor change when it was merged, so that issue is also resolved by this fix.