diff -u b/core/modules/breakpoint/lib/Drupal/breakpoint/Entity/BreakpointGroup.php b/core/modules/breakpoint/lib/Drupal/breakpoint/Entity/BreakpointGroup.php --- b/core/modules/breakpoint/lib/Drupal/breakpoint/Entity/BreakpointGroup.php +++ b/core/modules/breakpoint/lib/Drupal/breakpoint/Entity/BreakpointGroup.php @@ -11,6 +11,7 @@ use Drupal\breakpoint\BreakpointGroupInterface; use Drupal\breakpoint\InvalidBreakpointSourceException; use Drupal\breakpoint\InvalidBreakpointSourceTypeException; +use Drupal\Core\Entity\EntityStorageControllerInterface; /** * Defines the BreakpointGroup entity. @@ -224,2 +225,22 @@ } + + /** + * {@inheritdoc} + */ + public function preSave(EntityStorageControllerInterface $storage_controller) { + parent::preSave($storage_controller); + + $this->dependencies = array(); + if ($this->sourceType == Breakpoint::SOURCE_TYPE_MODULE) { + $this->createDependency('module', $this->source); + } + elseif ($this->sourceType == Breakpoint::SOURCE_TYPE_THEME) { + $this->createDependency('theme', $this->source); + } + $breakpoints = $this->getBreakpoints(); + foreach ($breakpoints as $breakpoint) { + $this->createDependency('module', $breakpoint->getConfigDependencyName()); + } + } + } diff -u b/core/modules/editor/lib/Drupal/editor/Entity/Editor.php b/core/modules/editor/lib/Drupal/editor/Entity/Editor.php --- b/core/modules/editor/lib/Drupal/editor/Entity/Editor.php +++ b/core/modules/editor/lib/Drupal/editor/Entity/Editor.php @@ -83,6 +83,10 @@ // Create a dependency of the linked filter. $filter = entity_load('filter_format', $this->format); $this->createDependency('entity', $filter->getConfigDependencyName()); + // @todo use EntityWithPluginBagInterface so configuration between config + // entity and dependency on provider is managed automatically. + $definition = \Drupal::service('plugin.manager.editor')->createInstance($this->editor)->getPluginDefinition(); + $this->createDependency('module', $definition['provider']); parent::preSave($storage_controller); } reverted: --- b/core/modules/search/config/entity.view_mode.node.search_index.yml +++ a/core/modules/search/config/entity.view_mode.node.search_index.yml @@ -3,7 +3,3 @@ status: false cache: true targetEntityType: node -dependencies: - module: - - node - - search reverted: --- b/core/modules/search/config/entity.view_mode.node.search_result.yml +++ a/core/modules/search/config/entity.view_mode.node.search_result.yml @@ -3,7 +3,3 @@ status: false cache: true targetEntityType: node -dependencies: - module: - - node - - search diff -u b/core/profiles/standard/config/block.block.bartik_breadcrumbs.yml b/core/profiles/standard/config/block.block.bartik_breadcrumbs.yml --- b/core/profiles/standard/config/block.block.bartik_breadcrumbs.yml +++ b/core/profiles/standard/config/block.block.bartik_breadcrumbs.yml @@ -25,0 +26,2 @@ + theme: + - bartik diff -u b/core/profiles/standard/config/block.block.bartik_content.yml b/core/profiles/standard/config/block.block.bartik_content.yml --- b/core/profiles/standard/config/block.block.bartik_content.yml +++ b/core/profiles/standard/config/block.block.bartik_content.yml @@ -25,0 +26,2 @@ + theme: + - bartik diff -u b/core/profiles/standard/config/block.block.bartik_footer.yml b/core/profiles/standard/config/block.block.bartik_footer.yml --- b/core/profiles/standard/config/block.block.bartik_footer.yml +++ b/core/profiles/standard/config/block.block.bartik_footer.yml @@ -25 +25,3 @@ - - system \ No newline at end of file + - system + theme: + - bartik diff -u b/core/profiles/standard/config/block.block.bartik_help.yml b/core/profiles/standard/config/block.block.bartik_help.yml --- b/core/profiles/standard/config/block.block.bartik_help.yml +++ b/core/profiles/standard/config/block.block.bartik_help.yml @@ -25 +25,3 @@ - - system \ No newline at end of file + - system + theme: + - bartik diff -u b/core/profiles/standard/config/block.block.bartik_login.yml b/core/profiles/standard/config/block.block.bartik_login.yml --- b/core/profiles/standard/config/block.block.bartik_login.yml +++ b/core/profiles/standard/config/block.block.bartik_login.yml @@ -25,0 +26,2 @@ + theme: + - bartik diff -u b/core/profiles/standard/config/block.block.bartik_powered.yml b/core/profiles/standard/config/block.block.bartik_powered.yml --- b/core/profiles/standard/config/block.block.bartik_powered.yml +++ b/core/profiles/standard/config/block.block.bartik_powered.yml @@ -25 +25,3 @@ - - system \ No newline at end of file + - system + theme: + - bartik diff -u b/core/profiles/standard/config/block.block.bartik_search.yml b/core/profiles/standard/config/block.block.bartik_search.yml --- b/core/profiles/standard/config/block.block.bartik_search.yml +++ b/core/profiles/standard/config/block.block.bartik_search.yml @@ -25,0 +26,2 @@ + theme: + - bartik diff -u b/core/profiles/standard/config/block.block.bartik_tools.yml b/core/profiles/standard/config/block.block.bartik_tools.yml --- b/core/profiles/standard/config/block.block.bartik_tools.yml +++ b/core/profiles/standard/config/block.block.bartik_tools.yml @@ -25 +25,3 @@ - - system \ No newline at end of file + - system + theme: + - bartik diff -u b/core/profiles/standard/config/block.block.seven_breadcrumbs.yml b/core/profiles/standard/config/block.block.seven_breadcrumbs.yml --- b/core/profiles/standard/config/block.block.seven_breadcrumbs.yml +++ b/core/profiles/standard/config/block.block.seven_breadcrumbs.yml @@ -25,0 +26,2 @@ + theme: + - seven diff -u b/core/profiles/standard/config/block.block.seven_content.yml b/core/profiles/standard/config/block.block.seven_content.yml --- b/core/profiles/standard/config/block.block.seven_content.yml +++ b/core/profiles/standard/config/block.block.seven_content.yml @@ -25,0 +26,2 @@ + theme: + - seven diff -u b/core/profiles/standard/config/block.block.seven_help.yml b/core/profiles/standard/config/block.block.seven_help.yml --- b/core/profiles/standard/config/block.block.seven_help.yml +++ b/core/profiles/standard/config/block.block.seven_help.yml @@ -25,0 +26,2 @@ + theme: + - seven diff -u b/core/profiles/standard/config/block.block.seven_login.yml b/core/profiles/standard/config/block.block.seven_login.yml --- b/core/profiles/standard/config/block.block.seven_login.yml +++ b/core/profiles/standard/config/block.block.seven_login.yml @@ -25,0 +26,2 @@ + theme: + - seven diff -u b/core/profiles/standard/config/editor.editor.basic_html.yml b/core/profiles/standard/config/editor.editor.basic_html.yml --- b/core/profiles/standard/config/editor.editor.basic_html.yml +++ b/core/profiles/standard/config/editor.editor.basic_html.yml @@ -46,0 +47,2 @@ + module: + - ckeditor diff -u b/core/profiles/standard/config/editor.editor.full_html.yml b/core/profiles/standard/config/editor.editor.full_html.yml --- b/core/profiles/standard/config/editor.editor.full_html.yml +++ b/core/profiles/standard/config/editor.editor.full_html.yml @@ -58,0 +59,2 @@ + module: + - ckeditor only in patch2: unchanged: --- a/core/lib/Drupal/Core/Extension/ThemeHandler.php +++ b/core/lib/Drupal/Core/Extension/ThemeHandler.php @@ -169,6 +169,11 @@ public function disable(array $theme_list) { $this->clearCssCache(); + // Remove configuration. + foreach ($theme_list as $key) { + \Drupal::service('config.manager')->uninstall('theme', $key); + } + $theme_config = $this->configFactory->get('system.theme'); $disabled_themes = $this->configFactory->get('system.theme.disabled'); foreach ($theme_list as $key) { only in patch2: unchanged: --- a/core/modules/block/custom_block/lib/Drupal/custom_block/Entity/CustomBlock.php +++ b/core/modules/block/custom_block/lib/Drupal/custom_block/Entity/CustomBlock.php @@ -103,7 +103,7 @@ public function getTheme() { */ public function preSave(EntityStorageControllerInterface $storage_controller) { parent::preSave($storage_controller); - + $this->createDependency('theme', $this->theme); // Before saving the custom block, set changed time. $this->set('changed', REQUEST_TIME); } only in patch2: unchanged: --- a/core/modules/block/lib/Drupal/block/Entity/Block.php +++ b/core/modules/block/lib/Drupal/block/Entity/Block.php @@ -11,6 +11,7 @@ use Drupal\block\BlockPluginBag; use Drupal\block\BlockInterface; use Drupal\Core\Config\Entity\EntityWithPluginBagInterface; +use Drupal\Core\Entity\EntityStorageControllerInterface; /** * Defines a Block configuration entity class. @@ -172,4 +173,12 @@ public static function sort($a, $b) { return strcmp($a->label(), $b->label()); } + /** + * {@inheritdoc} + */ + public function preSave(EntityStorageControllerInterface $storage_controller) { + parent::preSave($storage_controller); + $this->createDependency('theme', $this->theme); + } + } only in patch2: unchanged: --- a/core/modules/block/tests/modules/block_test/config/block.block.test_block.yml +++ b/core/modules/block/tests/modules/block_test/config/block.block.test_block.yml @@ -18,3 +18,8 @@ visibility: roles: { } node_type: types: { } +dependencies: + module: + - block_test + theme: + - stark only in patch2: unchanged: --- a/core/modules/breakpoint/breakpoint.module +++ b/core/modules/breakpoint/breakpoint.module @@ -39,106 +39,6 @@ function breakpoint_help($path, $arg) { } /** - * Implements hook_themes_disabled(). - * - * @param array $theme_list - * An array of theme names. - * - * @see _breakpoint_delete_breakpoints() - * - * @todo: This should be removed if https://drupal.org/node/1813110 is resolved. - */ -function breakpoint_themes_disabled($theme_list) { - _breakpoint_delete_breakpoints($theme_list, Breakpoint::SOURCE_TYPE_THEME); -} - -/** - * Implements hook_modules_uninstalled(). - * - * @param array $modules - * An array of the modules that were uninstalled. - * - * @see _breakpoint_delete_breakpoints() - * - * @todo: This should be removed if https://drupal.org/node/1813110 is resolved. - */ -function breakpoint_modules_uninstalled($modules) { - _breakpoint_delete_breakpoints($modules, Breakpoint::SOURCE_TYPE_MODULE); -} - -/** - * Remove breakpoints from all disabled themes or uninstalled modules. - * - * The source type has to match the original source type, otherwise the group - * will not be deleted. All groups created by the theme or module will be - * deleted as well. - * - * @param array $list - * A list of modules or themes that are disabled. - * @param string $source_type - * Either Breakpoint::SOURCE_TYPE_THEME or Breakpoint::SOURCE_TYPE_MODULE. - */ -function _breakpoint_delete_breakpoints($list, $source_type) { - $ids = \Drupal::configFactory()->listAll('breakpoint.breakpoint_group.' . $source_type . '.'); - $entity_manager = \Drupal::entityManager(); - $entity_type = $entity_manager->getDefinition('breakpoint_group'); - - // Remove the breakpoint.breakpoint part of the breakpoint identifier. - foreach ($ids as &$id) { - $id = ConfigStorageController::getIDFromConfigName($id, $entity_type->getConfigPrefix()); - } - $breakpoint_groups = entity_load_multiple('breakpoint_group', $ids); - - foreach ($breakpoint_groups as $breakpoint_group) { - if ($breakpoint_group->sourceType == $source_type && in_array($breakpoint_group->source, $list)) { - // Delete the automatically created breakpoint group. - $breakpoint_group->delete(); - - // Get all breakpoints defined by this theme/module. - $breakpoint_ids = \Drupal::service('config.storage')->listAll('breakpoint.breakpoint.' . $source_type . '.' . $breakpoint_group->id() . '.'); - $entity_type = $entity_manager->getDefinition('breakpoint'); - - // Remove the breakpoint.breakpoint part of the breakpoint identifier. - foreach ($breakpoint_ids as &$breakpoint_id) { - $breakpoint_id = ConfigStorageController::getIDFromConfigName($breakpoint_id, $entity_type->getConfigPrefix()); - } - $breakpoints = entity_load_multiple('breakpoint', $breakpoint_ids); - - // Make sure we only delete breakpoints defined by this theme/module. - foreach ($breakpoints as $breakpoint) { - if ($breakpoint->sourceType == $source_type && $breakpoint->source == $breakpoint_group->name) { - $breakpoint->delete(); - } - } - } - } - - // Delete groups defined by a module/theme even if that module/theme didn't - // define any breakpoints. - foreach ($ids as $id) { - // Delete all breakpoint groups defined by the theme or module. - _breakpoint_delete_breakpoint_groups($id, $source_type); - } -} - -/** - * Remove breakpoint groups from all disabled themes or uninstalled modules. - * - * @param array $group_id - * Machine readable name of the breakpoint group. - * @param string $source_type - * Either Breakpoint::SOURCE_TYPE_THEME or Breakpoint::SOURCE_TYPE_MODULE. - */ -function _breakpoint_delete_breakpoint_groups($group_id, $source_type) { - $breakpoint_groups = entity_load_multiple('breakpoint_group'); - foreach ($breakpoint_groups as $breakpoint_group) { - if ($breakpoint_group->sourceType == $source_type && $breakpoint_group->source == $group_id) { - $breakpoint_group->delete(); - } - } -} - -/** * Load one breakpoint by its identifier. * * @param int $id only in patch2: unchanged: --- a/core/modules/breakpoint/config/schema/breakpoint.schema.yml +++ b/core/modules/breakpoint/config/schema/breakpoint.schema.yml @@ -39,6 +39,9 @@ breakpoint.breakpoint.*.*.*: status: type: boolean label: 'Enabled' + dependencies: + type: config_dependency + label: 'Dependencies' breakpoint.breakpoint_group.*.*.*: type: mapping @@ -74,3 +77,6 @@ breakpoint.breakpoint_group.*.*.*: status: type: boolean label: 'Enabled' + dependencies: + type: config_dependency + label: 'Dependencies' only in patch2: unchanged: --- a/core/modules/breakpoint/lib/Drupal/breakpoint/BreakpointGroupInterface.php +++ b/core/modules/breakpoint/lib/Drupal/breakpoint/BreakpointGroupInterface.php @@ -51,7 +51,7 @@ public function addBreakpoints($breakpoints); /** * Gets the array of breakpoints for the breakpoint group. * - * @return array + * @return \Drupal\breakpoint\Entity\Breakpoint[] * The array of breakpoints for the breakpoint group. */ public function getBreakpoints(); only in patch2: unchanged: --- a/core/modules/breakpoint/lib/Drupal/breakpoint/Entity/Breakpoint.php +++ b/core/modules/breakpoint/lib/Drupal/breakpoint/Entity/Breakpoint.php @@ -14,6 +14,7 @@ use Drupal\breakpoint\InvalidBreakpointSourceException; use Drupal\breakpoint\InvalidBreakpointSourceTypeException; use Drupal\breakpoint\InvalidBreakpointMediaQueryException; +use Drupal\Core\Entity\EntityStorageControllerInterface; /** * Defines the Breakpoint entity. @@ -276,4 +277,19 @@ public static function isValidMediaQuery($media_query) { } throw new InvalidBreakpointMediaQueryException('Media query is empty.'); } + + /** + * {@inheritdoc} + */ + public function preSave(EntityStorageControllerInterface $storage_controller) { + parent::preSave($storage_controller); + $this->dependencies = array(); + if ($this->sourceType == static::SOURCE_TYPE_MODULE) { + $this->createDependency('module', $this->source); + } + elseif ($this->sourceType == static::SOURCE_TYPE_THEME) { + $this->createDependency('theme', $this->source); + } + } + } only in patch2: unchanged: --- a/core/modules/search/config/entity.view_mode.node.search_index.yml +++ b/core/modules/node/config/entity.view_mode.node.search_index.yml @@ -3,3 +3,6 @@ label: 'Search index' status: false cache: true targetEntityType: node +dependencies: + module: + - node only in patch2: unchanged: --- a/core/modules/search/config/entity.view_mode.node.search_result.yml +++ b/core/modules/node/config/entity.view_mode.node.search_result.yml @@ -3,3 +3,6 @@ label: 'Search result' status: false cache: true targetEntityType: node +dependencies: + module: + - node only in patch2: unchanged: --- a/core/modules/picture/config/schema/picture.schema.yml +++ b/core/modules/picture/config/schema/picture.schema.yml @@ -37,6 +37,9 @@ picture.mappings.*: langcode: type: string label: 'Default language' + dependencies: + type: config_dependency + label: 'Dependencies' entity_view_display.field.picture: type: entity_field_view_display_base only in patch2: unchanged: --- a/core/modules/picture/lib/Drupal/picture/Entity/PictureMapping.php +++ b/core/modules/picture/lib/Drupal/picture/Entity/PictureMapping.php @@ -8,6 +8,7 @@ namespace Drupal\picture\Entity; use Drupal\Core\Config\Entity\ConfigEntityBase; +use Drupal\Core\Entity\EntityStorageControllerInterface; use Drupal\picture\PictureMappingInterface; /** @@ -85,6 +86,21 @@ public function __construct(array $values, $entity_type) { } /** + * {@inheritdoc} + */ + public function preSave(EntityStorageControllerInterface $storage_controller) { + parent::preSave($storage_controller); + $this->dependencies = array(); + if (isset($this->breakpointGroup)) { + // @todo Implement getExportProperties() so we do not have reload the + // entity since this property is changed in + // \Drupal\picture\PictureMapping::save(). + $breakpoint_group = entity_load('breakpoint_group', $this->breakpointGroup); + $this->createDependency('entity', $breakpoint_group->getConfigDependencyName()); + } + } + + /** * Overrides Drupal\Core\Entity::save(). */ public function save() { only in patch2: unchanged: --- a/core/modules/tour/config/schema/tour.schema.yml +++ b/core/modules/tour/config/schema/tour.schema.yml @@ -34,6 +34,9 @@ tour.tour.*: sequence: - type: tour.tip.[plugin] label: 'Tour tip' + dependencies: + type: config_dependency + label: 'Dependencies' tour.tip: type: mapping only in patch2: unchanged: --- a/core/modules/tour/lib/Drupal/tour/Entity/Tour.php +++ b/core/modules/tour/lib/Drupal/tour/Entity/Tour.php @@ -8,6 +8,7 @@ namespace Drupal\tour\Entity; use Drupal\Core\Config\Entity\ConfigEntityBase; +use Drupal\Core\Entity\EntityStorageControllerInterface; use Drupal\tour\TipsBag; use Drupal\tour\TourInterface; @@ -168,4 +169,18 @@ public function resetKeyedRoutes() { unset($this->keyedRoutes); } + /** + * {@inheritdoc} + */ + public function preSave(EntityStorageControllerInterface $storage_controller) { + parent::preSave($storage_controller); + + foreach($this->tipsBag as $instance) { + $definition = $instance->getPluginDefinition(); + $this->createDependency('module', $definition['provider']); + } + + $this->createDependency('module', $this->module); + } + } only in patch2: unchanged: --- a/core/modules/views_ui/config/tour.tour.views-ui.yml +++ b/core/modules/views_ui/config/tour.tour.views-ui.yml @@ -87,3 +87,6 @@ tips: location: left attributes: data-id: views-display-extra-actions +dependencies: + module: + - views_ui only in patch2: unchanged: --- a/core/profiles/minimal/config/block.block.stark_admin.yml +++ b/core/profiles/minimal/config/block.block.stark_admin.yml @@ -18,3 +18,8 @@ visibility: roles: { } node_type: types: { } +dependencies: + module: + - system + theme: + - stark only in patch2: unchanged: --- a/core/profiles/minimal/config/block.block.stark_login.yml +++ b/core/profiles/minimal/config/block.block.stark_login.yml @@ -18,3 +18,8 @@ visibility: roles: { } node_type: types: { } +dependencies: + module: + - user + theme: + - stark only in patch2: unchanged: --- a/core/profiles/minimal/config/block.block.stark_tools.yml +++ b/core/profiles/minimal/config/block.block.stark_tools.yml @@ -18,3 +18,8 @@ visibility: roles: { } node_type: types: { } +dependencies: + module: + - system + theme: + - stark