Commit 3e7383d4 authored by catch's avatar catch

Issue #2261677 by alexpott, Berdir: Entity displays need to depend on the...

Issue #2261677 by alexpott, Berdir: Entity displays need to depend on the entity provider is there is no bundle entity type.
parent f9f3695d
......@@ -161,6 +161,10 @@ public function calculateDependencies() {
$bundle_entity = \Drupal::entityManager()->getStorage($bundle_entity_type_id)->load($this->bundle);
$this->addDependency('entity', $bundle_entity->getConfigDependencyName());
}
else {
// Depend on the provider of the entity type.
$this->addDependency('module', $target_entity_type->getProvider());
}
// Create dependencies on both hidden and visible fields.
$fields = $this->content + $this->hidden;
foreach ($fields as $field_name => $component) {
......
......@@ -88,7 +88,7 @@ public function testEntityDisplayCRUD() {
$new_display->save();
$new_display = entity_load('entity_view_display', $new_display->id());
$dependencies = $new_display->calculateDependencies();
$this->assertEqual(array('entity' => array('entity.view_mode.entity_test.other_view_mode')), $dependencies);
$this->assertEqual(array('entity' => array('entity.view_mode.entity_test.other_view_mode'), 'module' => array('entity_test')), $dependencies);
$this->assertEqual($new_display->targetEntityType, $display->targetEntityType);
$this->assertEqual($new_display->bundle, $display->bundle);
$this->assertEqual($new_display->mode, 'other_view_mode');
......@@ -201,7 +201,7 @@ public function testFieldComponent() {
// Check that the display has dependencies on the field and the module that
// provides the formatter.
$dependencies = $display->calculateDependencies();
$this->assertEqual(array('entity' => array('field.instance.entity_test.entity_test.test_field'), 'module' => array('field_test')), $dependencies);
$this->assertEqual(array('entity' => array('field.instance.entity_test.entity_test.test_field'), 'module' => array('entity_test', 'field_test')), $dependencies);
}
/**
......
......@@ -13,3 +13,4 @@ status: true
dependencies:
module:
- image
- user
......@@ -18,3 +18,4 @@ dependencies:
- entity.view_mode.user.compact
module:
- image
- user
......@@ -14,3 +14,4 @@ status: true
dependencies:
module:
- image
- user
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment