Loading core/modules/ckeditor/ckeditor.post_update.php +5 −31 Changes for core/modules/ckeditor/ckeditor.post_update.php: 5 added lines, 31 removed lines. Original line number Diff line number Diff line Loading @@ -5,37 +5,11 @@ * Post update functions for CKEditor. */ use Drupal\Core\Config\Entity\ConfigEntityUpdater; use Drupal\editor\Entity\Editor; /** * Updates Text Editors using CKEditor 4 to omit settings for disabled plugins. * Implements hook_removed_post_updates(). */ function ckeditor_post_update_omit_settings_for_disabled_plugins(&$sandbox = []) { $config_entity_updater = \Drupal::classResolver(ConfigEntityUpdater::class); $config_entity_updater->update($sandbox, 'editor', function (Editor $editor): bool { // Only try to update editors using CKEditor 4. if ($editor->getEditor() !== 'ckeditor') { return FALSE; } $enabled_plugins = _ckeditor_get_enabled_plugins($editor); // Only update if the editor has plugin settings for disabled plugins. $needs_update = FALSE; $settings = $editor->getSettings(); // Updates are not needed if plugin settings are not defined for the editor. if (!isset($settings['plugins'])) { return FALSE; } foreach (array_keys($settings['plugins']) as $plugin_id) { if (!in_array($plugin_id, $enabled_plugins, TRUE)) { $needs_update = TRUE; } } return $needs_update; }); function ckeditor_removed_post_updates() { return [ 'ckeditor_post_update_omit_settings_for_disabled_plugins' => '10.0.0', ]; } core/modules/ckeditor/tests/src/Functional/Update/CKEditorUpdateOmitDisabledPluginSettings.php −58 File deleted. Show changes core/modules/ckeditor5/ckeditor5.post_update.php +4 −42 Changes for core/modules/ckeditor5/ckeditor5.post_update.php: 4 added lines, 42 removed lines. Original line number Diff line number Diff line Loading @@ -5,49 +5,11 @@ * Post update functions for CKEditor 5. */ use Drupal\Core\Config\Entity\ConfigEntityUpdater; use Drupal\editor\Entity\Editor; /** * Updates if an already migrated CKEditor 5 configuration for text formats * has alignment shown as individual buttons instead of a dropdown. * Implements hook_removed_post_updates(). */ function ckeditor5_post_update_alignment_buttons(&$sandbox = []) { $config_entity_updater = \Drupal::classResolver(ConfigEntityUpdater::class); $callback = function (Editor $editor) { // Only try to update editors using CKEditor 5. if ($editor->getEditor() !== 'ckeditor5') { return FALSE; } $needs_update = FALSE; // Only update if the editor is using the non-dropdown buttons. $settings = $editor->getSettings(); $old_alignment_buttons_to_types = [ 'alignment:left' => 'left', 'alignment:right' => 'right', 'alignment:center' => 'center', 'alignment:justify' => 'justify', function ckeditor5_removed_post_updates() { return [ 'ckeditor5_post_update_alignment_buttons' => '10.0.0', ]; if (is_array($settings['toolbar']['items'])) { foreach ($old_alignment_buttons_to_types as $button => $type) { if (in_array($button, $settings['toolbar']['items'], TRUE)) { $settings['toolbar']['items'] = array_values(array_diff($settings['toolbar']['items'], [$button])); $settings['plugins']['ckeditor5_alignment']['enabled_alignments'][] = $type; if (!in_array('alignment', $settings['toolbar']['items'], TRUE)) { $settings['toolbar']['items'][] = 'alignment'; } // Flag this display as needing to be updated. $needs_update = TRUE; } } } if ($needs_update) { $editor->setSettings($settings); } return $needs_update; }; $config_entity_updater->update($sandbox, 'editor', $callback); } core/modules/ckeditor5/tests/src/Functional/Update/CKEditor5UpdateAlignmentTest.php −62 File deleted. Show changes core/modules/image/image.module −11 Changes for core/modules/image/image.module: 0 added lines, 11 removed lines. Original line number Diff line number Diff line Loading @@ -5,7 +5,6 @@ * Exposes global functionality for creating image styles. */ use Drupal\Core\Entity\Display\EntityViewDisplayInterface; use Drupal\Core\Entity\EntityInterface; use Drupal\Core\File\FileSystemInterface; use Drupal\Core\Routing\RouteMatchInterface; Loading @@ -15,7 +14,6 @@ use Drupal\field\FieldStorageConfigInterface; use Drupal\file\FileInterface; use Drupal\image\Entity\ImageStyle; use Drupal\image\ImageConfigUpdater; /** * The name of the query parameter for image derivative tokens. Loading Loading @@ -370,15 +368,6 @@ function image_entity_presave(EntityInterface $entity) { $entity->setSetting('default_image', $default_image); } /** * Implements hook_ENTITY_TYPE_presave() for entity_view_display. */ function image_entity_view_display_presave(EntityViewDisplayInterface $view_display): void { $config_updater = \Drupal::classResolver(ImageConfigUpdater::class); assert($config_updater instanceof ImageConfigUpdater); $config_updater->processImageLazyLoad($view_display); } /** * Implements hook_ENTITY_TYPE_update() for 'field_storage_config'. */ Loading Loading
core/modules/ckeditor/ckeditor.post_update.php +5 −31 Changes for core/modules/ckeditor/ckeditor.post_update.php: 5 added lines, 31 removed lines. Original line number Diff line number Diff line Loading @@ -5,37 +5,11 @@ * Post update functions for CKEditor. */ use Drupal\Core\Config\Entity\ConfigEntityUpdater; use Drupal\editor\Entity\Editor; /** * Updates Text Editors using CKEditor 4 to omit settings for disabled plugins. * Implements hook_removed_post_updates(). */ function ckeditor_post_update_omit_settings_for_disabled_plugins(&$sandbox = []) { $config_entity_updater = \Drupal::classResolver(ConfigEntityUpdater::class); $config_entity_updater->update($sandbox, 'editor', function (Editor $editor): bool { // Only try to update editors using CKEditor 4. if ($editor->getEditor() !== 'ckeditor') { return FALSE; } $enabled_plugins = _ckeditor_get_enabled_plugins($editor); // Only update if the editor has plugin settings for disabled plugins. $needs_update = FALSE; $settings = $editor->getSettings(); // Updates are not needed if plugin settings are not defined for the editor. if (!isset($settings['plugins'])) { return FALSE; } foreach (array_keys($settings['plugins']) as $plugin_id) { if (!in_array($plugin_id, $enabled_plugins, TRUE)) { $needs_update = TRUE; } } return $needs_update; }); function ckeditor_removed_post_updates() { return [ 'ckeditor_post_update_omit_settings_for_disabled_plugins' => '10.0.0', ]; }
core/modules/ckeditor/tests/src/Functional/Update/CKEditorUpdateOmitDisabledPluginSettings.php −58 File deleted. Show changes
core/modules/ckeditor5/ckeditor5.post_update.php +4 −42 Changes for core/modules/ckeditor5/ckeditor5.post_update.php: 4 added lines, 42 removed lines. Original line number Diff line number Diff line Loading @@ -5,49 +5,11 @@ * Post update functions for CKEditor 5. */ use Drupal\Core\Config\Entity\ConfigEntityUpdater; use Drupal\editor\Entity\Editor; /** * Updates if an already migrated CKEditor 5 configuration for text formats * has alignment shown as individual buttons instead of a dropdown. * Implements hook_removed_post_updates(). */ function ckeditor5_post_update_alignment_buttons(&$sandbox = []) { $config_entity_updater = \Drupal::classResolver(ConfigEntityUpdater::class); $callback = function (Editor $editor) { // Only try to update editors using CKEditor 5. if ($editor->getEditor() !== 'ckeditor5') { return FALSE; } $needs_update = FALSE; // Only update if the editor is using the non-dropdown buttons. $settings = $editor->getSettings(); $old_alignment_buttons_to_types = [ 'alignment:left' => 'left', 'alignment:right' => 'right', 'alignment:center' => 'center', 'alignment:justify' => 'justify', function ckeditor5_removed_post_updates() { return [ 'ckeditor5_post_update_alignment_buttons' => '10.0.0', ]; if (is_array($settings['toolbar']['items'])) { foreach ($old_alignment_buttons_to_types as $button => $type) { if (in_array($button, $settings['toolbar']['items'], TRUE)) { $settings['toolbar']['items'] = array_values(array_diff($settings['toolbar']['items'], [$button])); $settings['plugins']['ckeditor5_alignment']['enabled_alignments'][] = $type; if (!in_array('alignment', $settings['toolbar']['items'], TRUE)) { $settings['toolbar']['items'][] = 'alignment'; } // Flag this display as needing to be updated. $needs_update = TRUE; } } } if ($needs_update) { $editor->setSettings($settings); } return $needs_update; }; $config_entity_updater->update($sandbox, 'editor', $callback); }
core/modules/ckeditor5/tests/src/Functional/Update/CKEditor5UpdateAlignmentTest.php −62 File deleted. Show changes
core/modules/image/image.module −11 Changes for core/modules/image/image.module: 0 added lines, 11 removed lines. Original line number Diff line number Diff line Loading @@ -5,7 +5,6 @@ * Exposes global functionality for creating image styles. */ use Drupal\Core\Entity\Display\EntityViewDisplayInterface; use Drupal\Core\Entity\EntityInterface; use Drupal\Core\File\FileSystemInterface; use Drupal\Core\Routing\RouteMatchInterface; Loading @@ -15,7 +14,6 @@ use Drupal\field\FieldStorageConfigInterface; use Drupal\file\FileInterface; use Drupal\image\Entity\ImageStyle; use Drupal\image\ImageConfigUpdater; /** * The name of the query parameter for image derivative tokens. Loading Loading @@ -370,15 +368,6 @@ function image_entity_presave(EntityInterface $entity) { $entity->setSetting('default_image', $default_image); } /** * Implements hook_ENTITY_TYPE_presave() for entity_view_display. */ function image_entity_view_display_presave(EntityViewDisplayInterface $view_display): void { $config_updater = \Drupal::classResolver(ImageConfigUpdater::class); assert($config_updater instanceof ImageConfigUpdater); $config_updater->processImageLazyLoad($view_display); } /** * Implements hook_ENTITY_TYPE_update() for 'field_storage_config'. */ Loading