-
Notifications
You must be signed in to change notification settings - Fork 7
Expand file tree
/
Copy pathpatternkit.install
More file actions
683 lines (596 loc) · 21.9 KB
/
Copy pathpatternkit.install
File metadata and controls
683 lines (596 loc) · 21.9 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
<?php
/**
* @file
* Install file for patternkit module.
*/
use Drupal\Core\Cache\Cache;
use Drupal\Core\Config\FileStorage;
use Drupal\Core\Entity\ContentEntityType;
use Drupal\Core\Entity\EntityAccessControlHandler;
use Drupal\Core\Entity\EntityListBuilder;
use Drupal\Core\Entity\EntityViewBuilder;
use Drupal\Core\Entity\Sql\SqlContentEntityStorage;
use Drupal\Core\Entity\Sql\SqlContentEntityStorageSchema;
use Drupal\Core\Field\BaseFieldDefinition;
use Drupal\Core\Field\FieldStorageDefinitionInterface;
use Drupal\patternkit\BulkOperations\LayoutUpdateBatchManager;
use Drupal\patternkit\Entity\Pattern;
use Drupal\patternkit\Entity\PatternRouteProvider;
use Drupal\patternkit\Form\PatternLibraryJSONForm;
use Drupal\patternkit\Hook\ReusableBlockHooks;
use Drupal\patternkit\Plugin\Block\PatternkitBlock as BlockPatternkitBlock;
use Drupal\patternkit\Plugin\Derivative\PatternkitBlock as DerivativePatternkitBlock;
use Drupal\user\Entity\Role;
use Drupal\user\RoleInterface;
use Drupal\views\EntityViewsData;
/**
* Implements hook_uninstall().
*/
function patternkit_uninstall(bool $is_syncing): void {
// Cleanup the update results collection value if it exists.
\Drupal::keyValue(LayoutUpdateBatchManager::RESULTS_COLLECTION)
->deleteAll();
}
/**
* Implements hook_requirements().
*/
function patternkit_requirements($phase): array {
$requirements = [];
if ($phase === 'runtime') {
/** @var \Drupal\patternkit\Hook\ReusableBlockHooks $hooks */
$hooks = \Drupal::classResolver(ReusableBlockHooks::class);
$requirements = $hooks->requirements($phase);
}
return $requirements;
}
/**
* Allows upgrading from dev version automatically.
*
* @throws \Drupal\Core\Entity\Exception\EntityTypeIdLengthException
*/
function patternkit_update_8001(&$sandbox) {
// Installs new entities if necessary.
$entity_definition_update_manager = \Drupal::entityDefinitionUpdateManager();
if (!$entity_definition_update_manager->getEntityType('patternkit_pattern')) {
$pattern_entity_type = new ContentEntityType([
'id' => 'patternkit_pattern',
'class' => Pattern::class,
'label' => t('Pattern'),
'label_collection' => t('Pattern Libraries'),
'label_plural' => t('Patterns'),
'label_singular' => t('Pattern'),
'label_count' => [
'singular' => t('@count patterns'),
'plural' => t('@count custom blocks'),
],
'admin_permission' => 'administer blocks',
'base_table' => 'pattern',
'revision_table' => 'pattern_revision',
'entity_keys' => [
'id' => 'id',
'hash' => 'hash',
'assets' => 'assets',
'category' => 'category',
'label' => 'name',
'library' => 'library',
'libraryPluginId' => 'libraryPluginId',
'path' => 'path',
'revision' => 'revision',
'schema' => 'schema',
'template' => 'template',
'uuid' => 'uuid',
'version' => 'version',
],
'revision_metadata_keys' => [
'revision_default' => 'revision_default',
'revision_user' => 'revision_user',
'revision_created' => 'revision_created',
'revision_log_message' => 'revision_log_message',
],
'handlers' => [
'access' => EntityAccessControlHandler::class,
'storage' => SqlContentEntityStorage::class,
'storage_schema' => SqlContentEntityStorageSchema::class,
'view_builder' => EntityViewBuilder::class,
'views_data' => EntityViewsData::class,
'route_provider' => [
'html' => PatternRouteProvider::class,
],
'list_builder' => EntityListBuilder::class,
],
'links' => [
'canonical' => '/patternkit/{patternkit_pattern}',
'collection' => '/patternkit',
],
'translatable' => FALSE,
]);
$entity_definition_update_manager->installFieldableEntityType($pattern_entity_type, Pattern::baseFieldDefinitions($pattern_entity_type));
}
// Upgrades existing patterns.
/** @var \Drupal\patternkit\UpdateHelper $update_helper */
$update_helper = \Drupal::service('patternkit.helper.update');
$update_helper->updateAllPatternComponents();
// Clears caches.
$user_caches = [
'apcu_clear_cache',
'wincache_ucache_clear',
'xcache_clear_cache',
'opcache_reset',
];
array_map('call_user_func', array_filter($user_caches, 'is_callable'));
foreach (Cache::getBins() as $bin) {
$bin->deleteAll();
}
\Drupal::service('page_cache_kill_switch')->trigger();
drupal_flush_all_caches();
}
/**
* Adds proper revision metadata keys to Patternkit.
*/
function patternkit_update_8002(&$sandbox) {
$entity_definition_update_manager = \Drupal::entityDefinitionUpdateManager();
$entity_type = $entity_definition_update_manager->getEntityType('patternkit_pattern');
$metadata_keys = $entity_type->get('revision_metadata_keys');
$metadata_keys = is_array($metadata_keys) ? $metadata_keys : [];
$metadata_keys = [
'revision_default' => 'revision_default',
'revision_user' => 'revision_user',
'revision_created' => 'revision_created',
'revision_log_message' => 'revision_log_message',
] + $metadata_keys;
$entity_type->set('revision_metadata_keys', $metadata_keys);
$entity_definition_update_manager->updateEntityType($entity_type);
}
/**
* Adds reverse lookup pattern id field for Patternkit reusable blocks.
*/
function patternkit_update_8003(&$sandbox) {
$entity_definition_update_manager = \Drupal::entityDefinitionUpdateManager();
$entity_type = $entity_definition_update_manager->getEntityType('patternkit_block');
$entity_keys = $entity_type->get('entity_keys');
$entity_keys['pattern'] = 'pattern_id';
$entity_type->set('entity_keys', $entity_keys);
$pattern_id_field_definition = BaseFieldDefinition::create('string')
->setLabel(t('Patternkit Pattern Derivative ID'))
->setDescription(t('The machine name of the Patternkit pattern.'));
$entity_definition_update_manager
->installFieldStorageDefinition('pattern_id',
'patternkit_block', 'patternkit', $pattern_id_field_definition);
}
/**
* Sets default values for new json-editor settings.
*/
function patternkit_update_8004(&$sandbox) {
$config_key = 'patternkit.settings';
$patternkit_module_path = \Drupal::service('extension.list.module')
->getPath('patternkit');
$source = new FileStorage($patternkit_module_path . '/config/install');
$config_install = $source->read($config_key);
$config_current = \Drupal::configFactory()->getEditable($config_key);
$new_keys = [
'patternkit_json_editor_use_shadow_dom',
'patternkit_json_editor_wysiwyg',
'patternkit_json_editor_ckeditor_toolbar',
];
$changed = FALSE;
foreach ($new_keys as $new_key) {
if (is_null($config_current->get($new_key))) {
$config_current->set($new_key, $config_install[$new_key]);
$changed = TRUE;
}
}
if ($changed) {
$config_current->save();
}
}
/**
* Sets default value for new JSON Editor schema caching setting.
*/
function patternkit_update_8005(&$sandbox) {
$config_key = 'patternkit.settings';
$module_file_path = \Drupal::service('extension.list.module')
->getPath('patternkit');
$source = new FileStorage($module_file_path . '/config/install');
$config_install = $source->read($config_key);
$config_current = \Drupal::configFactory()->getEditable($config_key);
$new_key = 'patternkit_json_editor_cache_schemas';
if (is_null($config_current->get($new_key))) {
$config_current->set($new_key, $config_install[$new_key]);
$config_current->save();
}
}
/**
* Adds 'dependencies' field to 'patternkit_pattern' entities.
*/
function patternkit_update_9001(&$sandbox) {
$field_storage_definition = BaseFieldDefinition::create('string')
->setLabel(t('Dependencies'))
->setDescription(t('A collection of pattern reference dependencies detected within the Pattern.'))
->setCardinality(FieldStorageDefinitionInterface::CARDINALITY_UNLIMITED);
\Drupal::entityDefinitionUpdateManager()
->installFieldStorageDefinition('dependencies', 'patternkit_pattern', 'patternkit', $field_storage_definition);
}
/**
* Update Pattern entity properties to be revisionable fields.
*/
function patternkit_update_9002(&$sandbox) {
$database = \Drupal::database();
$transaction = $database->startTransaction();
$entity_type_manager = \Drupal::entityTypeManager();
$definition_manager = \Drupal::entityDefinitionUpdateManager();
$storage = $entity_type_manager->getStorage('patternkit_pattern');
assert($storage instanceof SqlContentEntityStorage);
$entity_definition = $entity_type_manager->getDefinition('patternkit_pattern');
$revision_id_key = $entity_definition->getKey('revision');
// If there is no data table defined then use the base table.
$table_name = $storage->getDataTable() ?: $storage->getBaseTable();
$revision_table_name = $storage->getRevisionDataTable() ?: $storage->getRevisionTable();
$keys = $entity_definition->getKeys();
unset($keys['hash']);
unset($keys['schema']);
unset($keys['template']);
unset($keys['version']);
$entity_definition->set('entity_keys', $keys);
$definition_manager->updateEntityType($entity_definition);
$fields = [];
$fields['hash'] = BaseFieldDefinition::create('string')
->setLabel(t('Hash'))
->setCardinality(1)
->setRevisionable(TRUE);
$fields['schema'] = BaseFieldDefinition::create('string_long')
->setLabel(t('Schema'))
->setCardinality(1)
->setRevisionable(TRUE);
$fields['template'] = BaseFieldDefinition::create('string_long')
->setLabel(t('Template'))
->setCardinality(1)
->setRevisionable(TRUE);
$fields['version'] = BaseFieldDefinition::create('string')
->setLabel(t('Version'))
->setCardinality(1)
->setRevisionable(TRUE);
$original_values = $database->select($table_name)
->fields($table_name, [
$revision_id_key,
'hash',
'schema',
'template',
'version',
])
->execute()
->fetchAllAssoc($revision_id_key);
foreach ($fields as $name => $definition) {
// Install the new definition.
$definition_manager->installFieldStorageDefinition($name, 'patternkit_pattern', 'patternkit', $definition);
}
// Map the original values into the revisions table.
foreach ($original_values as $id => $values) {
$database->update($revision_table_name)
->fields([
'hash' => $values->hash,
'schema' => $values->schema,
'template' => $values->template,
'version' => $values->version,
])
->condition($revision_id_key, $id)
->execute();
}
unset($transaction);
}
/**
* Grant user roles new 'administer patternkit' permission.
*/
function patternkit_update_9003() {
// Grant new permission to user roles that had the previous permission,
// `access administration pages`, to manage patternkit configuration.
$permission = 'access administration pages';
$roles = array_filter(Role::loadMultiple(), fn(RoleInterface $role) => $role->hasPermission($permission));
foreach ($roles as $role) {
$role->grantPermission('administer patternkit');
$role->save();
}
}
/**
* Remove deleted shadow dom settings from configuration.
*/
function patternkit_update_9004(): void {
$removed_settings = [
'patternkit_json_editor_use_shadow_dom',
];
$config_key = 'patternkit.settings';
$config = \Drupal::configFactory()->getEditable($config_key);
if ($config) {
// Remove each setting from the saved values.
foreach ($removed_settings as $setting) {
$config->clear($setting);
}
// Save the changes.
$config->save(TRUE);
}
}
/**
* Remove deleted cache usage settings from configuration.
*/
function patternkit_update_9005(): void {
$removed_settings = [
'patternkit_cache_enabled',
'patternkit_render_cache',
];
$config_key = 'patternkit.settings';
$config = \Drupal::configFactory()->getEditable($config_key);
if ($config) {
// Remove each setting from the saved values.
foreach ($removed_settings as $setting) {
$config->clear($setting);
}
// Save the changes.
$config->save(TRUE);
}
}
/**
* Remove ckeditor4 usage from configuration.
*/
function patternkit_update_9006(): ?string {
$config_key = 'patternkit.settings';
$wysiwyg_setting = 'patternkit_json_editor_wysiwyg';
$config = \Drupal::configFactory()->getEditable($config_key);
if ($config && $config->get($wysiwyg_setting) === 'ckeditor') {
// Remove ckeditor and toolbar configuration.
$config->set($wysiwyg_setting, '');
$config->set('patternkit_json_editor_ckeditor_toolbar', '');
// Save the changes.
$config->save(TRUE);
return t('Patternkit configuration using CKEditor 4 was removed. These settings will need to be reconfigured.');
}
return NULL;
}
/**
* Add token clear option to configuration.
*/
function patternkit_update_9007(): ?string {
$config = \Drupal::configFactory()->getEditable('patternkit.settings');
// Only set the new setting if it doesn't exist yet.
if ($config && $config->get('patternkit_json_editor_token_clear') === NULL) {
$config->set('patternkit_json_editor_token_clear', FALSE);
$config->save(TRUE);
return t('Patternkit configuration updated with default value for token clear option.');
}
return NULL;
}
/**
* Replace theme selections that were removed.
*/
function patternkit_update_10001(): void {
$config_key = 'patternkit.settings';
$theme_key = 'patternkit_json_editor_theme';
$default_theme = 'cygnet';
$config = \Drupal::configFactory()->getEditable($config_key);
if ($config) {
$selected_theme = $config->get($theme_key);
if (!isset(PatternLibraryJSONForm::THEMES[$selected_theme])) {
$config->set($theme_key, $default_theme);
$config->save(TRUE);
}
}
}
/**
* Clear Patternkit icon selections that were removed.
*/
function patternkit_update_10002(): void {
$config_key = 'patternkit.settings';
$setting = 'patternkit_json_editor_icons';
$config = \Drupal::configFactory()->getEditable($config_key);
if ($config) {
$selected = $config->get($setting);
if (!isset(PatternLibraryJSONForm::ICONS[$selected])) {
$config->clear($setting);
$config->save(TRUE);
}
}
}
/**
* Reset configuration for removed WYSIWYG editors.
*/
function patternkit_update_10003(): ?string {
$config_key = 'patternkit.settings';
$wysiwyg_setting = 'patternkit_json_editor_wysiwyg';
$config = \Drupal::configFactory()->getEditable($config_key);
if ($config && !isset(PatternLibraryJSONForm::EDITORS[$config->get($wysiwyg_setting)])) {
// Remove ckeditor and toolbar configuration.
$config->clear($wysiwyg_setting);
$config->clear('patternkit_json_editor_ckeditor_toolbar');
// Save the changes.
$config->save(TRUE);
return t('Patternkit configuration using removed editors was found. These settings will need to be reconfigured.');
}
return NULL;
}
/**
* Remove config for deprecated JSON Editor form JS and CSS attachment fields.
*/
function patternkit_update_10004(): string {
$config_key = 'patternkit.settings';
$config = \Drupal::configFactory()->getEditable($config_key);
$message = '';
if ($existing_css_value = $config->get('patternkit_json_editor_css')) {
$message .= t("Values for removed JSON Editor CSS additions were deleted: %settings\n", [
'%settings' => $existing_css_value,
]);
}
if ($existing_js_value = $config->get('patternkit_json_editor_js')) {
$message .= t("Values for removed JSON Editor JS additions were deleted: %settings\n", [
'%settings' => $existing_js_value,
]);
}
$config->clear('patternkit_json_editor_css');
$config->clear('patternkit_json_editor_js');
$config->save(TRUE);
return $message;
}
/**
* Migrate value for removed icons libraries.
*/
function patternkit_update_10005(): string {
$config_key = 'patternkit.settings';
$config = \Drupal::configFactory()->getEditable($config_key);
$message = '';
$icons_set_current = $config->get('patternkit_json_editor_icons');
if (empty($icons_set_current) || !isset(PatternLibraryJSONForm::ICONS[$icons_set_current])) {
$config->set('patternkit_json_editor_icons', '_none');
$config->save();
$message .= t('Icons set @current was changed to _none because support for that icons set has been removed.', [
'@current' => $icons_set_current,
]);
}
return $message;
}
/**
* Deprecated: Update config with new entity_cache_tag_invalidation setting.
*/
function patternkit_update_10305(): string {
return t('Replaced by patternkit_update_10306().');
}
/**
* Update config with new entity_cache_tag_invalidation setting.
*/
function patternkit_update_10306(): string {
// Replaces patternkit_update_10305().
$config_key = 'patternkit.settings';
$config = \Drupal::configFactory()->getEditable($config_key);
$message = '';
$current = $config->get('entity_cache_tag_invalidation');
if ($current === NULL) {
$config->set('entity_cache_tag_invalidation', FALSE);
$config->save();
$message = t('Set new Patternkit entity cache tag invalidation setting to FALSE.');
}
return $message;
}
/**
* Update patternkit block records to correctly reference pattern ids.
*/
function patternkit_update_10307(): string {
$storage = \Drupal::entityTypeManager()->getStorage('patternkit_block');
$query = $storage->getQuery();
$matches = $query->condition('pattern_id', '@%', 'NOT LIKE')
->accessCheck()
->execute();
/** @var \Drupal\patternkit\Entity\PatternkitBlock[] $entities */
$entities = $storage->loadMultiple($matches);
$updated = 0;
foreach ($entities as $block) {
$derivative_id = $block->get('pattern_id')->value;
$asset_id = DerivativePatternkitBlock::derivativeToAssetId($derivative_id);
$block->set('pattern_id', $asset_id, FALSE);
$block->save();
$updated++;
\Drupal::logger('patternkit')->notice('Updated Patternkit block ID @id to correct pattern asset ID from "@old" to "@new".',
[
'@id' => $block->id(),
'@old' => $derivative_id,
'@new' => $asset_id,
]);
}
if ($updated > 0) {
return \Drupal::translation()
->formatPlural($updated, 'Fixed asset IDs for 1 block.', 'Fixed asset IDs for @count blocks.');
}
else {
return t('No invalid asset IDs were found.');
}
}
/**
* Capture unsaved changes in Patternkit blocks.
*/
function patternkit_update_10308(): string {
// Identify all patternkit blocks with serialized changes.
$block_storage = \Drupal::entityTypeManager()->getStorage('block');
$query = $block_storage->getQuery();
$matches = $query->condition('settings.provider', 'patternkit')
->condition('settings.block_serialized', operator: 'IS NOT NULL')
->accessCheck(FALSE)
->execute();
$entities = $block_storage->loadMultiple($matches);
$message = \Drupal::translation()
->formatPlural(count($entities),
'Identified 1 Patternkit Block with unsaved changes.',
'Identified @count Patternkit blocks with unsaved changes.'
);
\Drupal::logger('patternkit')->notice($message);
// Save serialized content changes.
$updated = 0;
foreach ($entities as $block) {
$plugin = $block->getPlugin();
if (!($plugin instanceof BlockPatternkitBlock)) {
\Drupal::logger('patternkit')->warning(
'Skipping config block "@id" (plugin "@block_id"): plugin did not resolve to a PatternkitBlock instance. Pending serialized edits for this block were not applied.',
[
'@id' => $block->id(),
'@block_id' => $block->getPluginId(),
]
);
continue;
}
$plugin->cachePatternEntity();
$plugin->saveBlockContent(TRUE);
$post_save_configuration = $plugin->getConfiguration();
$block->set('settings', $post_save_configuration);
$block->save();
$updated++;
}
if ($updated > 0) {
return \Drupal::translation()
->formatPlural($updated, 'Saved updated configuration for 1 block.', 'Saved updated configuration for @count blocks.');
}
else {
return t('No invalid blocks were found.');
}
}
/**
* No-op: retain reusable field storage until 9.2.0 removal.
*
* Supersedes the prior 9.1.x update that dropped the reusable column before
* the 9.1.3 migration window. Sites that already ran the column drop keep that
* state; this hook is a no-op for upgrades that had not yet run it.
*
* Sites that already ran the pre-release removal are handled by
* patternkit_update_10310(), which restores the column. Because update hooks
* run exactly once (tracked by system.schema), a modified 10309 would never
* re-execute for those sites; a new hook number is required.
*
* @see https://www.drupal.org/project/patternkit/issues/3587714
* @see https://www.drupal.org/project/patternkit/issues/3587730
*/
function patternkit_update_10309(): string {
return t('No schema change: Patternkit reusable block field storage is retained for the 9.1.x migration window; removal is scheduled for 9.2.0.');
}
/**
* Restore reusable field storage dropped by a pre-release removal hook.
*
* A pre-release build of 9.1.x shipped patternkit_update_10309() as a
* column-drop. Sites that ran that hook have no reusable column, which causes
* hook_requirements() to throw a DB exception on the status report page.
* Because 10309 already executed on those sites it is skipped on upgrade;
* this hook restores the field storage so the 9.1.x migration window is
* available to all sites.
*
* Sites where the column is already present follow the no-op path.
*
* @see https://www.drupal.org/project/patternkit/issues/3587714
* @see https://www.drupal.org/project/patternkit/issues/3587730
*/
function patternkit_update_10310(): string {
$edm = \Drupal::entityDefinitionUpdateManager();
if ($edm->getFieldStorageDefinition('reusable', 'patternkit_block')) {
return t('No schema change: reusable field storage is already present.');
}
$field_definitions = \Drupal::service('entity_field.manager')
->getBaseFieldDefinitions('patternkit_block');
$edm->installFieldStorageDefinition(
'reusable',
'patternkit_block',
'patternkit',
$field_definitions['reusable']
);
return t('Restored reusable field storage for the 9.1.x migration window.');
}