Last active
April 21, 2026 08:18
-
-
Save steffenr/bd51d52e52439a5d5406fe7223c546e2 to your computer and use it in GitHub Desktop.
Fix mismatched rabbit_hole__settings field storage definitions.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| /** | |
| * Fix mismatched rabbit_hole__settings field storage definitions. | |
| */ | |
| function my_module_update_9001():void { | |
| $updates = \Drupal::entityDefinitionUpdateManager(); | |
| $field_manager = \Drupal::service('entity_field.manager'); | |
| $entity_types = ['node', 'taxonomy_term']; | |
| foreach ($entity_types as $entity_type_id) { | |
| // Get all field storage definitions for this entity type. | |
| $storage_definitions = $field_manager->getFieldStorageDefinitions($entity_type_id); | |
| // If the Rabbit Hole field exists, apply the updated storage definition. | |
| if (isset($storage_definitions['rabbit_hole__settings'])) { | |
| $updates->updateFieldStorageDefinition($storage_definitions['rabbit_hole__settings']); | |
| } | |
| } | |
| } | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment