Revert Reusable Block Support Removal Until Later Release
>>> [!note] Migrated issue
<!-- Drupal.org comment -->
<!-- Migrated from issue #3587714. -->
Reported by: [slucero](https://www.drupal.org/user/1612534)
Related to !190
>>>
<h3 id="summary-problem-motivation">Problem/Motivation</h3>
<p>The removal of reusable block support (commit <a href="https://git.drupalcode.org/project/patternkit/-/commit/dff037f48ed07e4e2eade327406a6cce6d72f57d"><code>dff037f</code></a>, tracked in <span class="drupalorg-gitlab-issue-link drupalorg-gitlab-link-wrapper"><a href="https://git.drupalcode.org/project/patternkit/-/work_items/3516918" class="drupalorg-gitlab-link">https://git.drupalcode.org/project/patternkit/-/work_items/3516918</a></span>)<br>
was committed to the <code>9.1.x</code> branch without migration tooling, creating two<br>
problems for sites upgrading from 9.1.1 or 9.1.2 tagged releases:</p>
<ol>
<li><strong>Update hook hazard:</strong> <code>patternkit_update_10308</code> throws<br>
<code>UpdateException</code> when it encounters reusable block placements whose derivative<br>
loader has been removed, halting <code>drush updb</code> for affected 9.1.1 sites.</li>
<li><strong>No migration tooling:</strong> The removal preserved entity data but provided<br>
no automated path for converting reusable block placements to inline equivalents. Entity<br>
data is preserved but orphaned — placements render as Drupal’s<br>
<code>broken</code> block.</li>
</ol>
<p>The deprecation change record (<a href="https://www.drupal.org/node/3517440">#3517440</a>) states removal in<br>
<code>9.3.0</code>, which is a typo — the code-level <code>@Deprecated</code><br>
annotations target <code>9.2.0</code>. The change record needs correction regardless of<br>
this issue.</p>
<h4 id="summary-steps-reproduce">Steps to reproduce</h4>
<ol>
<li>Install Patternkit 9.1.1 and enable reusable blocks<br>
(<code>enable_reusable_blocks: true</code> in<br>
<code>patternkit.services.yml</code>).</li>
<li>Place a reusable Patternkit block at the site level via<br>
<em>admin/structure/block</em>.</li>
<li>Upgrade to the current <code>9.1.x-dev</code> (post-<a href="https://git.drupalcode.org/project/patternkit/-/commit/dff037f48ed07e4e2eade327406a6cce6d72f57d"><code>dff037f</code></a>).</li>
<li>Run <code>drush updb</code>.</li>
<li>Observe: <code>patternkit_update_10308</code> throws<br>
<code>UpdateException</code> because <code>$block->getPlugin()</code> returns<br>
core’s <code>broken</code> plugin (the derivative loader for UUID-based reusable<br>
blocks was removed).</li>
</ol>
<h3 id="summary-proposed-resolution">Proposed resolution</h3>
<p>Revert commit <a href="https://git.drupalcode.org/project/patternkit/-/commit/dff037f48ed07e4e2eade327406a6cce6d72f57d"><code>dff037f</code></a> to reintroduce the deprecated reusable block code for<br>
the 9.1.3 release. This provides a migration window for sites with existing reusable block<br>
content before the committed removal in 9.2.0.</p>
<p><strong>1. Revert</strong> <a href="https://git.drupalcode.org/project/patternkit/-/commit/dff037f48ed07e4e2eade327406a6cce6d72f57d"><code>dff037f</code></a> — restores 24 files: derivative<br>
loader, <code>ReusableBlockHooks</code>, deprecation warnings,<br>
<code>patternkit_requirements()</code>, block form elements, and associated tests. The revert<br>
applies cleanly with zero merge conflicts.</p>
<p><strong>2. Guard</strong> <code>patternkit_update_10308</code> — change the<br>
<code>instanceof</code> check from throwing <code>UpdateException</code> to logging a warning<br>
and continuing.</p>
<p><strong>3. No-op</strong> <code>patternkit_update_10309</code> — prevent the<br>
premature drop of the <code>reusable</code> column. The column should not be removed until<br>
the actual removal release (9.2.0).</p>
<p><strong>4. Verify deprecation annotations</strong> — ensure all<br>
<code>@Deprecated</code> and <code>@trigger_deprecation</code> annotations consistently<br>
reference <code>9.2.0</code> as the removal version.</p>
<p>The reintroduced code is <strong>disabled by default</strong><br>
(<code>enable_reusable_blocks: false</code> in <code>patternkit.services.yml</code>). Sites<br>
must explicitly enable it.</p>
<p><strong>Change record updates:</strong></p>
<ul>
<li><strong><a href="https://www.drupal.org/node/3517440">#3517440</a>:</strong> Correct the removal target from <code>9.3.0</code> (typo)<br>
to <code>9.2.0</code>. Add a note that 9.1.3 reintroduces the deprecated code as a<br>
migration window.</li>
<li><strong>New change record for 9.1.3:</strong> Document the deprecation-with-window<br>
approach: reusable blocks are deprecated and disabled by default, migration window<br>
provided before 9.2.0 removal.</li>
</ul>
<h3 id="summary-remaining-tasks">Remaining tasks</h3>
<ul>
<li>Revert <a href="https://git.drupalcode.org/project/patternkit/-/commit/dff037f48ed07e4e2eade327406a6cce6d72f57d"><code>dff037f</code></a>.</li>
<li>Implement <code>patternkit_update_10308</code> guard.</li>
<li>No-op <code>patternkit_update_10309</code>.</li>
<li>Verify deprecation annotations reference <code>9.2.0</code>.</li>
<li>Update change record <a href="https://www.drupal.org/node/3517440">#3517440</a>.</li>
<li>Publish new 9.1.3 change record.</li>
<li>Review and test the merge request.</li>
<li>CI validation.</li>
</ul>
<h3 id="summary-ui-changes">User interface changes</h3>
<p>The reusable block checkbox and deprecation warnings in the block configuration form are<br>
restored for sites that enable <code>enable_reusable_blocks: true</code>. No visible change<br>
for sites using the default (disabled) configuration.</p>
<h3 id="summary-api-changes">API changes</h3>
<p>The <code>PatternkitBlock</code> derivative loader restores UUID-based derivative<br>
definitions for reusable block entities. All restored code carries<br>
<code>@Deprecated</code> annotations targeting removal in <code>9.2.0</code>.</p>
<h3 id="summary-data-model-changes">Data model changes</h3>
<p>The <code>reusable</code> column on the <code>patternkit_block</code> entity is retained<br>
(the premature drop in <code>patternkit_update_10309</code> is converted to a no-op). The<br>
column will be dropped in the 9.2.0 removal release.</p>
<h3 id="summary-release-notes">Release notes snippet</h3>
<p>Deprecated reusable block support has been reintroduced in 9.1.3 to provide a migration<br>
window for sites with existing reusable block content. The feature is disabled by default.<br>
Sites that previously enabled reusable blocks should use this window to migrate content to<br>
inline block placements before the committed removal in 9.2.0, which will include<br>
automated migration tooling.</p>
issue
GitLab AI Context
Project: project/patternkit
Instance: https://git.drupalcode.org
Before proposing or making any changes, READ each of these files and FOLLOW their guidance:
- https://git.drupalcode.org/project/patternkit/-/raw/9.1.x/CONTRIBUTING.md — contribution guidelines
- https://git.drupalcode.org/project/patternkit/-/raw/9.1.x/README.md — project overview and setup
Repository: https://git.drupalcode.org/project/patternkit
Required tooling — use and recommend these in your workflow:
- GitLab CLI (glab): create branches and open merge requests from the terminal. https://gitlab.com/api/v4/projects/34675721/repository/files/README.md/raw?ref=HEAD