use Drupal\Core\Entity\EntityStorageInterface;
use Drupal\Core\Entity\FieldableEntityInterface;
use Drupal\Core\Entity\EntityDisplayBase;
-use Drupal\Core\TypedData\TranslatableInterface;
+use Drupal\Core\Render\Element;
+use Drupal\Core\TypedData\TranslatableInterface as TranslatableDataInterface;
/**
* Configuration entity that contains display options for all components of a
* "id" = "id",
* "status" = "status"
* },
+ * handlers = {
+ * "access" = "\Drupal\Core\Entity\Entity\Access\EntityViewDisplayAccessControlHandler",
+ * },
* config_export = {
* "id",
* "targetEntityType",
'view_mode' => $this->originalMode,
// No need to prepare, defaults have been merged in setComponent().
'prepare' => FALSE,
- 'configuration' => $configuration
+ 'configuration' => $configuration,
]);
}
else {
// those values using:
// - the entity language if the entity is translatable,
// - the current "content language" otherwise.
- if ($entity instanceof TranslatableInterface && $entity->isTranslatable()) {
+ if ($entity instanceof TranslatableDataInterface && $entity->isTranslatable()) {
$view_langcode = $entity->language()->getId();
}
else {
foreach ($entities as $id => $entity) {
// Assign the configured weights.
foreach ($this->getComponents() as $name => $options) {
- if (isset($build_list[$id][$name])) {
+ if (isset($build_list[$id][$name]) && !Element::isEmpty($build_list[$id][$name])) {
$build_list[$id][$name]['#weight'] = $options['weight'];
}
}
}
return [
- 'formatters' => new EntityDisplayPluginCollection($this->pluginManager, $configurations)
+ 'formatters' => new EntityDisplayPluginCollection($this->pluginManager, $configurations),
];
}