diff -u b/core/lib/Drupal/Core/Config/ConfigManager.php b/core/lib/Drupal/Core/Config/ConfigManager.php --- b/core/lib/Drupal/Core/Config/ConfigManager.php +++ b/core/lib/Drupal/Core/Config/ConfigManager.php @@ -187,7 +187,8 @@ $entities = array(); $definitions = $this->entityManager->getDefinitions(); foreach ($dependencies as $config_name => $dependency) { - // Group by entity type so we can use load multiple. + // Group by entity type to efficient load entities using + // \Drupal\Core\Entity\EntityStorageControllerInterface::loadMultiple(). $entity_type_id = $this->getEntityTypeIdByName($config_name); // It is possible that a non-configuration entity will be returned if a // simple configuration object has a UUID key. This would occur if the diff -u b/core/lib/Drupal/Core/Config/Entity/ConfigDependencyManager.php b/core/lib/Drupal/Core/Config/Entity/ConfigDependencyManager.php --- b/core/lib/Drupal/Core/Config/Entity/ConfigDependencyManager.php +++ b/core/lib/Drupal/Core/Config/Entity/ConfigDependencyManager.php @@ -19,16 +19,16 @@ * example, node types are created before their fields and the fields are * created before their field instances. * - * Dependencies are written to the configuration entity so that they can be - * checked without the module that provides the configuration entity class being - * installed. This is important for configuration synchronization which needs to - * be able to validate configuration in the staging directory before the - * synchronization has occurred. + * Dependencies are stored to the configuration entity's configuration object so + * that they can be checked without the module that provides the configuration + * entity class being installed. This is important for configuration + * synchronization which needs to be able to validate configuration in the + * staging directory before the synchronization has occurred. * * Configuration entities determine their dependencies by implementing * \Drupal\Core\Config\Entity\ConfigEntityInterface::calculateDependencies(). - * This method should be called from the entity's implementation of - * \Drupal\Core\Entity\EntityInterface::preSave(). Implementations should use + * This method should be called from the configuration entity's implementation + * of \Drupal\Core\Entity\EntityInterface::preSave(). Implementations should use * the helper method * \Drupal\Core\Config\Entity\ConfigEntityBase::addDependency() to add * dependencies. All the implementations in core call the parent method @@ -78,17 +78,16 @@ public function getDependentEntities($type, $name) { $dependent_entities = array(); - if ($type == 'module' || $type == 'theme') { - $dependent_entities = array_filter($this->data, function (ConfigEntityDependency $entity) use ($type, $name) { - return $entity->hasDependency($type, $name); - }); - } - $entities_to_check = array(); if ($type == 'entity') { $entities_to_check[] = $name; } else { + if ($type == 'module' || $type == 'theme') { + $dependent_entities = array_filter($this->data, function (ConfigEntityDependency $entity) use ($type, $name) { + return $entity->hasDependency($type, $name); + }); + } // If checking module or theme dependencies then discover which entities // are dependent on the entities that have a direct dependency. foreach ($dependent_entities as $entity) { @@ -108,9 +107,8 @@ */ public function sortAll() { $graph = $this->getGraph(); - // Sort by reverse weight and alphabetically. So the most dependent entities - // are last but entities with the same weight are alphabetically ordered in - // the same way file system reads often are. + // Sort by reverse weight and alphabetically. The most dependent entities + // are last and entities with the same weight are alphabetically ordered. uasort($graph, array($this, 'sortGraph')); return array_keys($graph); } diff -u b/core/lib/Drupal/Core/Config/Entity/ConfigEntityBase.php b/core/lib/Drupal/Core/Config/Entity/ConfigEntityBase.php --- b/core/lib/Drupal/Core/Config/Entity/ConfigEntityBase.php +++ b/core/lib/Drupal/Core/Config/Entity/ConfigEntityBase.php @@ -64,7 +64,7 @@ private $isSyncing = FALSE; /** - * Whether the config is deleted through the uninstall process. + * Whether the config is being deleted by the uninstall process. * * @var bool */ diff -u b/core/lib/Drupal/Core/Config/Entity/ConfigEntityDependency.php b/core/lib/Drupal/Core/Config/Entity/ConfigEntityDependency.php --- b/core/lib/Drupal/Core/Config/Entity/ConfigEntityDependency.php +++ b/core/lib/Drupal/Core/Config/Entity/ConfigEntityDependency.php @@ -8,7 +8,9 @@ namespace Drupal\Core\Config\Entity; /** - * Class ConfigEntityDependency + * Provides a value object to discover configuration dependencies. + * + * @see \Drupal\Core\Config\Entity\ConfigDependencyManager */ class ConfigEntityDependency { diff -u b/core/lib/Drupal/Core/Config/Entity/ConfigEntityInterface.php b/core/lib/Drupal/Core/Config/Entity/ConfigEntityInterface.php --- b/core/lib/Drupal/Core/Config/Entity/ConfigEntityInterface.php +++ b/core/lib/Drupal/Core/Config/Entity/ConfigEntityInterface.php @@ -92,7 +92,7 @@ public function isSyncing(); /** - * Returns whether the configuration entity is deleted through the import + * Returns whether the configuration entity is being deleted by the uninstall * process. * * @return bool diff -u b/core/lib/Drupal/Core/Config/Schema/core.data_types.schema.yml b/core/lib/Drupal/Core/Config/Schema/core.data_types.schema.yml --- b/core/lib/Drupal/Core/Config/Schema/core.data_types.schema.yml +++ b/core/lib/Drupal/Core/Config/Schema/core.data_types.schema.yml @@ -138,7 +138,7 @@ label: 'Param' # Config dependencies. -config_dependency: +config_dependencies: type: mapping label: 'Configuration dependencies' mapping: diff -u b/core/lib/Drupal/Core/Extension/ModuleHandler.php b/core/lib/Drupal/Core/Extension/ModuleHandler.php --- b/core/lib/Drupal/Core/Extension/ModuleHandler.php +++ b/core/lib/Drupal/Core/Extension/ModuleHandler.php @@ -725,16 +725,14 @@ // Uninstall the module. module_load_install($module); $this->invoke($module, 'uninstall'); - - // Remove all configuration belonging to the module. - \Drupal::service('config.manager')->uninstall('module', $module); - - // Remove the schema. drupal_uninstall_schema($module); // Remove the module's entry from the config. $module_config->clear("enabled.$module")->save(); + // Remove all configuration belonging to the module. + \Drupal::service('config.manager')->uninstall('module', $module); + // Update the module handler to remove the module. // The current ModuleHandler instance is obsolete with the kernel rebuild // below. @@ -761,14 +759,16 @@ // Uninstall the module. module_load_install($module); $this->invoke($module, 'uninstall'); + + // Remove all configuration belonging to the module. + \Drupal::service('config.manager')->uninstall('module', $module); + + // Remove the schema. drupal_uninstall_schema($module); // Remove the module's entry from the config. $module_config->clear("enabled.$module")->save(); - // Remove all configuration belonging to the module. - \Drupal::service('config.manager')->uninstall('module', $module); - // Update the module handler to remove the module. // The current ModuleHandler instance is obsolete with the kernel rebuild // below. diff -u b/core/modules/block/config/schema/block.schema.yml b/core/modules/block/config/schema/block.schema.yml --- b/core/modules/block/config/schema/block.schema.yml +++ b/core/modules/block/config/schema/block.schema.yml @@ -93,3 +93,3 @@ dependencies: - type: config_dependency + type: config_dependencies label: 'Dependencies' diff -u b/core/modules/breakpoint/config/schema/breakpoint.schema.yml b/core/modules/breakpoint/config/schema/breakpoint.schema.yml --- b/core/modules/breakpoint/config/schema/breakpoint.schema.yml +++ b/core/modules/breakpoint/config/schema/breakpoint.schema.yml @@ -40,7 +40,7 @@ type: boolean label: 'Enabled' dependencies: - type: config_dependency + type: config_dependencies label: 'Dependencies' breakpoint.breakpoint_group.*.*.*: @@ -80,3 +80,3 @@ dependencies: - type: config_dependency + type: config_dependencies label: 'Dependencies' diff -u b/core/modules/config/lib/Drupal/config/Tests/ConfigDependencyTest.php b/core/modules/config/lib/Drupal/config/Tests/ConfigDependencyTest.php --- b/core/modules/config/lib/Drupal/config/Tests/ConfigDependencyTest.php +++ b/core/modules/config/lib/Drupal/config/Tests/ConfigDependencyTest.php @@ -104,7 +104,7 @@ $this->assertTrue(isset($dependents['config_test.dynamic.entity4']), 'config_test.dynamic.entity4 has a dependency on the Node module.'); // Test getting node module's dependencies as configuration dependency - // objects after making $entity3 also dependent on node module but $entity_1 + // objects after making $entity3 also dependent on node module but $entity1 // no longer depend on node module. $entity1->test_dependencies = array(); $entity1->save(); diff -u b/core/modules/config/lib/Drupal/config/Tests/ConfigOtherModuleTest.php b/core/modules/config/lib/Drupal/config/Tests/ConfigOtherModuleTest.php --- b/core/modules/config/lib/Drupal/config/Tests/ConfigOtherModuleTest.php +++ b/core/modules/config/lib/Drupal/config/Tests/ConfigOtherModuleTest.php @@ -94,7 +94,7 @@ } /** - * Tests uninstalling node module removes views which are dependent on it. + * Tests uninstalling Node module removes views which are dependent on it. */ public function testUninstall() { $this->moduleHandler->install(array('views')); diff -u b/core/modules/editor/config/schema/editor.schema.yml b/core/modules/editor/config/schema/editor.schema.yml --- b/core/modules/editor/config/schema/editor.schema.yml +++ b/core/modules/editor/config/schema/editor.schema.yml @@ -47,3 +47,3 @@ dependencies: - type: config_dependency + type: config_dependencies label: 'Dependencies' diff -u b/core/modules/entity/config/schema/entity.schema.yml b/core/modules/entity/config/schema/entity.schema.yml --- b/core/modules/entity/config/schema/entity.schema.yml +++ b/core/modules/entity/config/schema/entity.schema.yml @@ -26,7 +26,7 @@ type: string label: 'Default language' dependencies: - type: config_dependency + type: config_dependencies label: 'Dependencies' entity.form_mode.*.*: @@ -55,7 +55,7 @@ type: string label: 'Default language' dependencies: - type: config_dependency + type: config_dependencies label: 'Dependencies' # Overview configuration information for view mode or form mode displays. @@ -93,7 +93,7 @@ - type: boolean label: 'Value' dependencies: - type: config_dependency + type: config_dependencies label: 'Dependencies' # Overview configuration information for form mode displays. @@ -125,7 +125,7 @@ type: boolean label: 'Enabled' dependencies: - type: config_dependency + type: config_dependencies label: 'Dependencies' # Default schema for entity display field with undefined type. diff -u b/core/modules/entity/lib/Drupal/entity/EntityDisplayBase.php b/core/modules/entity/lib/Drupal/entity/EntityDisplayBase.php --- b/core/modules/entity/lib/Drupal/entity/EntityDisplayBase.php +++ b/core/modules/entity/lib/Drupal/entity/EntityDisplayBase.php @@ -167,6 +167,8 @@ if ($field_instance) { $this->addDependency('entity', $field_instance->getConfigDependencyName()); } + // Create a dependency on the module that provides the formatter or + // widget. if (isset($component['type'])) { $definition = $this->pluginManager->getDefinition($component['type']); $this->addDependency('module', $definition['provider']); diff -u b/core/modules/field/config/schema/field.schema.yml b/core/modules/field/config/schema/field.schema.yml --- b/core/modules/field/config/schema/field.schema.yml +++ b/core/modules/field/config/schema/field.schema.yml @@ -57,7 +57,7 @@ - type: string label: 'Column' dependencies: - type: config_dependency + type: config_dependencies label: 'Dependencies' field.instance.*.*.*: @@ -108,7 +108,7 @@ type: string label: 'Field type' dependencies: - type: config_dependency + type: config_dependencies label: 'Dependencies' entity_form_display.field.hidden: diff -u b/core/modules/rdf/config/schema/rdf.schema.yml b/core/modules/rdf/config/schema/rdf.schema.yml --- b/core/modules/rdf/config/schema/rdf.schema.yml +++ b/core/modules/rdf/config/schema/rdf.schema.yml @@ -29,3 +29,3 @@ dependencies: - type: config_dependency + type: config_dependencies label: 'Dependencies' diff -u b/core/modules/responsive_image/config/schema/responsive_image.schema.yml b/core/modules/responsive_image/config/schema/responsive_image.schema.yml --- b/core/modules/responsive_image/config/schema/responsive_image.schema.yml +++ b/core/modules/responsive_image/config/schema/responsive_image.schema.yml @@ -38,7 +38,7 @@ type: string label: 'Default language' dependencies: - type: config_dependency + type: config_dependencies label: 'Dependencies' entity_view_display.field.responsive_image: diff -u b/core/modules/search/config/schema/search.schema.yml b/core/modules/search/config/schema/search.schema.yml --- b/core/modules/search/config/schema/search.schema.yml +++ b/core/modules/search/config/schema/search.schema.yml @@ -97,3 +97,3 @@ dependencies: - type: config_dependency + type: config_dependencies label: 'Dependencies' diff -u b/core/modules/system/config/schema/system.schema.yml b/core/modules/system/config/schema/system.schema.yml --- b/core/modules/system/config/schema/system.schema.yml +++ b/core/modules/system/config/schema/system.schema.yml @@ -338,7 +338,7 @@ configuration: type: action.configuration.[plugin] dependencies: - type: config_dependency + type: config_dependencies label: 'Dependencies' system.file: diff -u b/core/modules/tour/config/schema/tour.schema.yml b/core/modules/tour/config/schema/tour.schema.yml --- b/core/modules/tour/config/schema/tour.schema.yml +++ b/core/modules/tour/config/schema/tour.schema.yml @@ -35,7 +35,7 @@ - type: tour.tip.[plugin] label: 'Tour tip' dependencies: - type: config_dependency + type: config_dependencies label: 'Dependencies' tour.tip: diff -u b/core/modules/views/config/schema/views.schema.yml b/core/modules/views/config/schema/views.schema.yml --- b/core/modules/views/config/schema/views.schema.yml +++ b/core/modules/views/config/schema/views.schema.yml @@ -120,3 +120,3 @@ dependencies: - type: config_dependency + type: config_dependencies label: 'Dependencies'