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 @@ -727,6 +727,10 @@ drupal_uninstall_schema($module); // Remove all dependent configuration entities. + // @todo Move above schema uninstall and delete configuration entities + // using configuration entity API. This does not work at the moment + // because exceptions are thrown during a delete. For example + // \Drupal\language\Entity\Language::preDelete(). $dependent_entities = \Drupal::service('config.manager')->findConfigEntityDependents('module', array($module)); foreach ($dependent_entities as $dependent_entity) { \Drupal::configFactory()->get($dependent_entity->getName())->delete(); diff -u b/core/modules/field/lib/Drupal/field/Entity/Field.php b/core/modules/field/lib/Drupal/field/Entity/Field.php --- b/core/modules/field/lib/Drupal/field/Entity/Field.php +++ b/core/modules/field/lib/Drupal/field/Entity/Field.php @@ -337,6 +337,9 @@ // definition is passed to the various hooks and written to config. $this->settings += $field_type['settings']; + // Ensure the field is dependent on the providing module. + $this->createDependency('module', $this->module); + // Notify the entity storage controller. $entity_manager->getStorageController($this->entity_type)->onFieldCreate($this); } diff -u b/core/modules/views/lib/Drupal/views/Entity/View.php b/core/modules/views/lib/Drupal/views/Entity/View.php --- b/core/modules/views/lib/Drupal/views/Entity/View.php +++ b/core/modules/views/lib/Drupal/views/Entity/View.php @@ -279,6 +279,9 @@ */ public function preSave(EntityStorageControllerInterface $storage_controller) { parent::preSave($storage_controller); + // Clear out the dependencies since we're going to recalculate them. + $this->dependencies = array(); + // Ensure that the view is dependant on the module that implements the view. $this->createDependency('module', $this->module); // Ensure that the view is dependant on the module that provides the schema @@ -287,6 +290,22 @@ if ($this->module != $schema['module']) { $this->createDependency('module', $schema['module']); } + + $handler_types = array(); + foreach (ViewExecutable::viewsHandlerTypes() as $type) { + $handler_types[] = $type['plural']; + } + foreach ($this->get('display') as $display) { + foreach ($handler_types as $handler_type) { + if (!empty($display['display_options'][$handler_type])) { + foreach ($display['display_options'][$handler_type] as $handler) { + if (isset($handler['provider'])) { + $this->createDependency('module', $handler['provider']); + } + } + } + } + } } /** only in patch2: unchanged: --- a/core/modules/field/config/schema/field.schema.yml +++ b/core/modules/field/config/schema/field.schema.yml @@ -56,6 +56,9 @@ field.field.*.*: sequence: - type: string label: 'Column' + dependencies: + type: config_dependency + label: 'Dependencies' field.instance.*.*.*: type: mapping @@ -104,6 +107,9 @@ field.instance.*.*.*: field_type: type: string label: 'Field type' + dependencies: + type: config_dependency + label: 'Dependencies' entity_form_display.field.hidden: type: entity_field_form_display_base only in patch2: unchanged: --- a/core/modules/field/field.module +++ b/core/modules/field/field.module @@ -148,6 +148,10 @@ function field_cron() { * * Goes through a list of all modules that provide a field type and makes them * required if there are any active fields of that type. + * + * @todo Remove once fields are deleted through the entity API in + * \Drupal\Core\Extension\ModuleHandler::uninstall(). See + * https://drupal.org/node/2080823 for more information. */ function field_system_info_alter(&$info, $file, $type) { // It is not safe to call entity_load_multiple_by_properties() during only in patch2: unchanged: --- a/core/modules/field/lib/Drupal/field/Entity/FieldInstance.php +++ b/core/modules/field/lib/Drupal/field/Entity/FieldInstance.php @@ -318,6 +318,7 @@ public function getExportProperties() { 'default_value', 'default_value_function', 'settings', + 'dependencies', ); $properties = array(); foreach ($names as $name) { @@ -367,6 +368,9 @@ public function preSave(EntityStorageControllerInterface $storage_controller) { // Notify the entity storage controller. $entity_manager->getStorageController($this->entity_type)->onInstanceUpdate($this); } + + // Manage dependencies. + $this->createDependency('entity', $this->field->getConfigDependencyName()); } /** only in patch2: unchanged: --- a/core/modules/field/tests/modules/field_test_config/config/field.field.entity_test.field_test_import.yml +++ b/core/modules/field/tests/modules/field_test_config/config/field.field.entity_test.field_test_import.yml @@ -12,3 +12,6 @@ translatable: false indexes: format: - format +dependencies: + module: + text: true only in patch2: unchanged: --- a/core/modules/field/tests/modules/field_test_config/config/field.field.entity_test.field_test_import_2.yml +++ b/core/modules/field/tests/modules/field_test_config/config/field.field.entity_test.field_test_import_2.yml @@ -12,3 +12,6 @@ translatable: false indexes: format: - format +dependencies: + module: + text: true only in patch2: unchanged: --- a/core/modules/field/tests/modules/field_test_config/staging/field.field.entity_test.field_test_import_staging.yml +++ b/core/modules/field/tests/modules/field_test_config/staging/field.field.entity_test.field_test_import_staging.yml @@ -13,3 +13,6 @@ translatable: '0' indexes: format: - format +dependencies: + module: + text: true only in patch2: unchanged: --- a/core/modules/field/tests/modules/field_test_config/staging/field.field.entity_test.field_test_import_staging_2.yml +++ b/core/modules/field/tests/modules/field_test_config/staging/field.field.entity_test.field_test_import_staging_2.yml @@ -13,3 +13,6 @@ translatable: '0' indexes: format: - format +dependencies: + module: + text: true only in patch2: unchanged: --- a/core/modules/forum/config/field.field.forum.forum_container.yml +++ b/core/modules/forum/config/field.field.forum.forum_container.yml @@ -15,3 +15,6 @@ locked: true cardinality: 1 translatable: false indexes: { } +dependencies: + module: + options: true only in patch2: unchanged: --- a/core/modules/locale/lib/Drupal/locale/Tests/LocaleConfigTranslationTest.php +++ b/core/modules/locale/lib/Drupal/locale/Tests/LocaleConfigTranslationTest.php @@ -131,7 +131,7 @@ function testConfigTranslation() { // Enable the image module. $this->drupalPostForm('admin/modules', array('modules[Field types][image][enable]' => "1"), t('Save configuration')); - $this->resetAll(); + $this->rebuildContainer(); $string = $this->storage->findString(array('source' => 'Medium (220x220)', 'context' => '', 'type' => 'configuration')); $this->assertTrue($string, 'Configuration strings have been created upon installation.'); only in patch2: unchanged: --- a/core/profiles/standard/config/field.field.node.field_image.yml +++ b/core/profiles/standard/config/field.field.node.field_image.yml @@ -33,3 +33,6 @@ indexes: - target_id status: true langcode: und +dependencies: + module: + image: true only in patch2: unchanged: --- a/core/profiles/standard/config/field.field.node.field_tags.yml +++ b/core/profiles/standard/config/field.field.node.field_tags.yml @@ -17,3 +17,6 @@ indexes: - target_id status: true langcode: und +dependencies: + module: + taxonomy: true only in patch2: unchanged: --- a/core/profiles/standard/config/field.field.user.user_picture.yml +++ b/core/profiles/standard/config/field.field.user.user_picture.yml @@ -33,3 +33,6 @@ translatable: false indexes: target_id: - target_id +dependencies: + module: + image: true