Skip to content
Snippets Groups Projects

Issue #3314957 by dave reid: Add dependencies on selected entities, view modes, and entity browser

Merged Issue #3314957 by dave reid: Add dependencies on selected entities, view modes, and entity browser
Merged Stephen Mustgrave requested to merge issue/entity_browser_block-3314957:3314957-2.x into 2.0.x
1 file
+ 17
0
Compare changes
  • Side-by-side
  • Inline
@@ -312,4 +312,21 @@ class EntityBrowserBlock extends BlockBase implements ContainerFactoryPluginInte
return $build;
}
/**
* {@inheritdoc}
*/
public function calculateDependencies(): array {
$dependencies = parent::calculateDependencies();
if ($entities = static::loadEntitiesByIDs($this->configuration['entity_ids'])) {
foreach ($entities as $id => $entity) {
$dependencies[$entity->getConfigDependencyKey()][] = $entity->getConfigDependencyName();
$view_mode = $this->configuration['view_modes'][$id];
$dependencies['config'][] = 'core.entity_view_display.' . $entity->getEntityTypeId() . '.' . $entity->bundle() . $view_mode;
}
}
// This block is dependent on the entity browser itself.
$dependencies['config'][] = 'entity_browser.browser.' . $this->getDerivativeId();
return $dependencies;
}
}
Loading