Chris@0: listAll(); Chris@0: $sandbox['count'] = count($sandbox['config_names']); Chris@0: } Chris@0: /** @var \Drupal\Core\Config\ConfigManagerInterface $config_manager */ Chris@0: $config_manager = \Drupal::service('config.manager'); Chris@0: Chris@0: $count = 0; Chris@0: foreach ($sandbox['config_names'] as $key => $config_name) { Chris@0: if ($entity = $config_manager->loadConfigEntityByName($config_name)) { Chris@0: $entity->save(); Chris@0: } Chris@0: unset($sandbox['config_names'][$key]); Chris@0: $count++; Chris@0: // Do 50 at a time. Chris@0: if ($count == 50) { Chris@0: break; Chris@0: } Chris@0: } Chris@0: Chris@0: $sandbox['#finished'] = empty($sandbox['config_names']) ? 1 : ($sandbox['count'] - count($sandbox['config_names'])) / $sandbox['count']; Chris@0: return t('Configuration dependencies recalculated'); Chris@0: } Chris@0: Chris@0: /** Chris@0: * Update entity displays to contain the region for each field. Chris@0: */ Chris@0: function system_post_update_add_region_to_entity_displays() { Chris@0: $entity_save = function (EntityDisplayInterface $entity) { Chris@0: // preSave() will fill in the correct region based on the 'type'. Chris@0: $entity->save(); Chris@0: }; Chris@0: array_map($entity_save, EntityViewDisplay::loadMultiple()); Chris@0: array_map($entity_save, EntityFormDisplay::loadMultiple()); Chris@0: } Chris@0: Chris@0: Chris@0: /** Chris@0: * Force caches using hashes to be cleared (Twig, render cache, etc.). Chris@0: */ Chris@0: function system_post_update_hashes_clear_cache() { Chris@0: // Empty post-update hook. Chris@0: } Chris@0: Chris@0: /** Chris@0: * Force plugin definitions to be cleared. Chris@0: * Chris@0: * @see https://www.drupal.org/node/2802663 Chris@0: */ Chris@0: function system_post_update_timestamp_plugins() { Chris@0: // Empty post-update hook. Chris@0: } Chris@0: Chris@0: /** Chris@0: * Clear caches to ensure Classy's message library is always added. Chris@0: */ Chris@0: function system_post_update_classy_message_library() { Chris@0: // Empty post-update hook. Chris@0: } Chris@0: Chris@0: /** Chris@0: * Force field type plugin definitions to be cleared. Chris@0: * Chris@0: * @see https://www.drupal.org/node/2403703 Chris@0: */ Chris@0: function system_post_update_field_type_plugins() { Chris@0: // Empty post-update hook. Chris@0: } Chris@0: Chris@0: /** Chris@0: * Clear caches due to schema changes in core.entity.schema.yml. Chris@0: */ Chris@0: function system_post_update_field_formatter_entity_schema() { Chris@0: // Empty post-update hook. Chris@0: } Chris@0: Chris@0: /** Chris@0: * Change plugin IDs of actions. Chris@0: */ Chris@0: function system_post_update_change_action_plugins() { Chris@0: $old_new_action_id_map = [ Chris@0: 'comment_publish_action' => 'entity:publish_action:comment', Chris@0: 'comment_unpublish_action' => 'entity:unpublish_action:comment', Chris@0: 'comment_save_action' => 'entity:save_action:comment', Chris@0: 'node_publish_action' => 'entity:publish_action:node', Chris@0: 'node_unpublish_action' => 'entity:unpublish_action:node', Chris@0: 'node_save_action' => 'entity:save_action:node', Chris@0: ]; Chris@0: Chris@0: /** @var \Drupal\system\Entity\Action[] $actions */ Chris@0: $actions = \Drupal::entityTypeManager()->getStorage('action')->loadMultiple(); Chris@0: foreach ($actions as $action) { Chris@0: if (isset($old_new_action_id_map[$action->getPlugin()->getPluginId()])) { Chris@0: $action->setPlugin($old_new_action_id_map[$action->getPlugin()->getPluginId()]); Chris@0: $action->save(); Chris@0: } Chris@0: } Chris@0: }