class EntityDisplayBase
Same name in other branches
- 9 core/lib/Drupal/Core/Entity/EntityDisplayBase.php \Drupal\Core\Entity\EntityDisplayBase
- 8.9.x core/lib/Drupal/Core/Entity/EntityDisplayBase.php \Drupal\Core\Entity\EntityDisplayBase
- 11.x core/lib/Drupal/Core/Entity/EntityDisplayBase.php \Drupal\Core\Entity\EntityDisplayBase
Provides a common base class for entity view and form displays.
Hierarchy
- class \Drupal\Core\Entity\EntityBase implements \Drupal\Core\Entity\EntityInterface uses \Drupal\Core\Cache\RefinableCacheableDependencyTrait, \Drupal\Core\DependencyInjection\DependencySerializationTrait
- class \Drupal\Core\Config\Entity\ConfigEntityBase extends \Drupal\Core\Entity\EntityBase implements \Drupal\Core\Config\Entity\ConfigEntityInterface uses \Drupal\Core\Plugin\PluginDependencyTrait, \Drupal\Core\Entity\SynchronizableEntityTrait
- class \Drupal\Core\Entity\EntityDisplayBase extends \Drupal\Core\Config\Entity\ConfigEntityBase implements \Drupal\Core\Entity\Display\EntityDisplayInterface
- class \Drupal\Core\Config\Entity\ConfigEntityBase extends \Drupal\Core\Entity\EntityBase implements \Drupal\Core\Config\Entity\ConfigEntityInterface uses \Drupal\Core\Plugin\PluginDependencyTrait, \Drupal\Core\Entity\SynchronizableEntityTrait
Expanded class hierarchy of EntityDisplayBase
4 files declare their use of EntityDisplayBase
- EntityDisplayBaseTest.php in core/
tests/ Drupal/ Tests/ Core/ Config/ Entity/ EntityDisplayBaseTest.php - EntityFormDisplay.php in core/
lib/ Drupal/ Core/ Entity/ Entity/ EntityFormDisplay.php - EntityViewDisplay.php in core/
lib/ Drupal/ Core/ Entity/ Entity/ EntityViewDisplay.php - FieldBlock.php in core/
modules/ layout_builder/ src/ Plugin/ Block/ FieldBlock.php
File
-
core/
lib/ Drupal/ Core/ Entity/ EntityDisplayBase.php, line 15
Namespace
Drupal\Core\EntityView source
abstract class EntityDisplayBase extends ConfigEntityBase implements EntityDisplayInterface {
/**
* The mode used to render entities with arbitrary display options.
*
* @todo Prevent creation of a mode with this ID
* https://www.drupal.org/node/2410727
*/
const CUSTOM_MODE = '_custom';
/**
* Unique ID for the config entity.
*
* @var string
*/
protected $id;
/**
* Entity type to be displayed.
*
* @var string
*/
protected $targetEntityType;
/**
* Bundle to be displayed.
*
* @var string
*/
protected $bundle;
/**
* A list of field definitions eligible for configuration in this display.
*
* @var \Drupal\Core\Field\FieldDefinitionInterface[]
*/
protected $fieldDefinitions;
/**
* View or form mode to be displayed.
*
* @var string
*/
protected $mode = self::CUSTOM_MODE;
/**
* Whether this display is enabled or not.
*
* If the entity (form) display is disabled, we'll fall back to the 'default'
* display.
*
* @var bool
*/
protected $status;
/**
* List of component display options, keyed by component name.
*
* @var array
*/
protected $content = [];
/**
* List of components that are set to be hidden.
*
* @var array
*/
protected $hidden = [];
/**
* The original view or form mode that was requested.
*
* Case of view/form modes being configured to fall back to the 'default'
* display.
*
* @var string
*/
protected $originalMode;
/**
* The plugin objects used for this display, keyed by field name.
*
* @var array
*/
protected $plugins = [];
/**
* Context in which this entity will be used (e.g. 'view', 'form').
*
* @var string
*/
protected $displayContext;
/**
* The plugin manager used by this entity type.
*
* @var \Drupal\Component\Plugin\PluginManagerBase
*/
protected $pluginManager;
/**
* The renderer.
*
* @var \Drupal\Core\Render\RendererInterface
*/
protected $renderer;
/**
* A boolean indicating whether or not this display has been initialized.
*
* @var bool
*/
protected $initialized = FALSE;
/**
* {@inheritdoc}
*/
public function __construct(array $values, $entity_type) {
if (!isset($values['targetEntityType']) || !isset($values['bundle'])) {
throw new \InvalidArgumentException('Missing required properties for an EntityDisplay entity.');
}
if (!$this->entityTypeManager()
->getDefinition($values['targetEntityType'])
->entityClassImplements(FieldableEntityInterface::class)) {
throw new \InvalidArgumentException('EntityDisplay entities can only handle fieldable entity types.');
}
$this->renderer = \Drupal::service('renderer');
// A plugin manager and a context type needs to be set by extending classes.
if (!isset($this->pluginManager)) {
throw new \RuntimeException('Missing plugin manager.');
}
if (!isset($this->displayContext)) {
throw new \RuntimeException('Missing display context type.');
}
parent::__construct($values, $entity_type);
$this->originalMode = $this->mode;
$this->init();
}
/**
* Initializes the display.
*
* This fills in default options for components:
* - that are not explicitly known as either "visible" or "hidden" in the
* display,
* - or that are not supposed to be configurable.
*/
protected function init() {
// Only populate defaults for "official" view modes and form modes.
if (!$this->initialized && $this->mode !== static::CUSTOM_MODE) {
$this->initialized = TRUE;
$default_region = $this->getDefaultRegion();
// Fill in defaults for extra fields.
$context = $this->displayContext == 'view' ? 'display' : $this->displayContext;
$extra_fields = \Drupal::service('entity_field.manager')->getExtraFields($this->targetEntityType, $this->bundle);
$extra_fields = $extra_fields[$context] ?? [];
foreach ($extra_fields as $name => $definition) {
if (!isset($this->content[$name]) && !isset($this->hidden[$name])) {
// Extra fields are visible by default unless they explicitly say so.
if (!isset($definition['visible']) || $definition['visible'] == TRUE) {
$this->setComponent($name, [
'weight' => $definition['weight'],
]);
}
else {
$this->removeComponent($name);
}
}
// Ensure extra fields have a 'region'.
if (isset($this->content[$name])) {
$this->content[$name] += [
'region' => $default_region,
];
}
}
// Fill in defaults for fields.
$fields = $this->getFieldDefinitions();
foreach ($fields as $name => $definition) {
if (!$definition->isDisplayConfigurable($this->displayContext) || !isset($this->content[$name]) && !isset($this->hidden[$name])) {
$options = $definition->getDisplayOptions($this->displayContext);
if (!empty($options['region']) && $options['region'] === 'hidden') {
$this->removeComponent($name);
}
elseif ($options) {
$options += [
'region' => $default_region,
];
$this->setComponent($name, $options);
}
// Note: (base) fields that do not specify display options are not
// tracked in the display at all, in order to avoid cluttering the
// configuration that gets saved back.
}
}
}
}
/**
* {@inheritdoc}
*/
public function getTargetEntityTypeId() {
return $this->targetEntityType;
}
/**
* {@inheritdoc}
*/
public function getMode() {
return $this->get('mode');
}
/**
* {@inheritdoc}
*/
public function getOriginalMode() {
return $this->get('originalMode');
}
/**
* {@inheritdoc}
*/
public function getTargetBundle() {
return $this->bundle;
}
/**
* {@inheritdoc}
*/
public function setTargetBundle($bundle) {
$this->set('bundle', $bundle);
return $this;
}
/**
* {@inheritdoc}
*/
public function id() {
return $this->targetEntityType . '.' . $this->bundle . '.' . $this->mode;
}
/**
* {@inheritdoc}
*/
public function preSave(EntityStorageInterface $storage) {
// Ensure that a region is set on each component.
foreach ($this->getComponents() as $name => $component) {
// Ensure that a region is set.
if (isset($this->content[$name]) && !isset($component['region'])) {
// Directly set the component to bypass other changes in setComponent().
$this->content[$name]['region'] = $this->getDefaultRegion();
}
}
ksort($this->content);
ksort($this->hidden);
parent::preSave($storage);
}
/**
* {@inheritdoc}
*/
public function calculateDependencies() {
parent::calculateDependencies();
$target_entity_type = $this->entityTypeManager()
->getDefinition($this->targetEntityType);
// Create dependency on the bundle.
$bundle_config_dependency = $target_entity_type->getBundleConfigDependency($this->bundle);
$this->addDependency($bundle_config_dependency['type'], $bundle_config_dependency['name']);
// If field.module is enabled, add dependencies on 'field_config' entities
// for both displayed and hidden fields. We intentionally leave out base
// field overrides, since the field still exists without them.
if (\Drupal::moduleHandler()->moduleExists('field')) {
$components = $this->content + $this->hidden;
$field_definitions = \Drupal::service('entity_field.manager')->getFieldDefinitions($this->targetEntityType, $this->bundle);
foreach (array_intersect_key($field_definitions, $components) as $field_definition) {
if ($field_definition instanceof ConfigEntityInterface && $field_definition->getEntityTypeId() == 'field_config') {
$this->addDependency('config', $field_definition->getConfigDependencyName());
}
}
}
// Depend on configured modes.
if ($this->mode != 'default') {
$mode_entity = $this->entityTypeManager()
->getStorage('entity_' . $this->displayContext . '_mode')
->load($target_entity_type->id() . '.' . $this->mode);
$this->addDependency('config', $mode_entity->getConfigDependencyName());
}
return $this;
}
/**
* {@inheritdoc}
*/
public function toArray() {
$properties = parent::toArray();
// Do not store options for fields whose display is not set to be
// configurable.
foreach ($this->getFieldDefinitions() as $field_name => $definition) {
if (!$definition->isDisplayConfigurable($this->displayContext)) {
unset($properties['content'][$field_name]);
unset($properties['hidden'][$field_name]);
}
}
return $properties;
}
/**
* {@inheritdoc}
*/
public function createCopy($mode) {
$display = $this->createDuplicate();
$display->mode = $display->originalMode = $mode;
return $display;
}
/**
* {@inheritdoc}
*/
public function getComponents() {
return $this->content;
}
/**
* {@inheritdoc}
*/
public function getComponent($name) {
return $this->content[$name] ?? NULL;
}
/**
* {@inheritdoc}
*/
public function setComponent($name, array $options = []) {
// If no weight specified, make sure the field sinks at the bottom.
if (!isset($options['weight'])) {
$max = $this->getHighestWeight();
$options['weight'] = isset($max) ? $max + 1 : 0;
}
// For a field, fill in default options.
if ($field_definition = $this->getFieldDefinition($name)) {
$options = $this->pluginManager
->prepareConfiguration($field_definition->getType(), $options);
}
// Ensure we always have an empty settings and array.
$options += [
'settings' => [],
'third_party_settings' => [],
];
$this->content[$name] = $options;
unset($this->hidden[$name]);
unset($this->plugins[$name]);
return $this;
}
/**
* {@inheritdoc}
*/
public function removeComponent($name) {
$this->hidden[$name] = TRUE;
unset($this->content[$name]);
unset($this->plugins[$name]);
return $this;
}
/**
* {@inheritdoc}
*/
public function getHighestWeight() {
$weights = [];
// Collect weights for the components in the display.
foreach ($this->content as $options) {
if (isset($options['weight'])) {
$weights[] = $options['weight'];
}
}
// Let other modules feedback about their own additions.
$weights = array_merge($weights, \Drupal::moduleHandler()->invokeAll('field_info_max_weight', [
$this->targetEntityType,
$this->bundle,
$this->displayContext,
$this->mode,
]));
return $weights ? max($weights) : NULL;
}
/**
* Gets the field definition of a field.
*/
protected function getFieldDefinition($field_name) {
$definitions = $this->getFieldDefinitions();
return $definitions[$field_name] ?? NULL;
}
/**
* Gets the definitions of the fields that are candidate for display.
*/
protected function getFieldDefinitions() {
if (!isset($this->fieldDefinitions)) {
$definitions = \Drupal::service('entity_field.manager')->getFieldDefinitions($this->targetEntityType, $this->bundle);
// For "official" view modes and form modes, ignore fields whose
// definition states they should not be displayed.
if ($this->mode !== static::CUSTOM_MODE) {
$definitions = array_filter($definitions, [
$this,
'fieldHasDisplayOptions',
]);
}
$this->fieldDefinitions = $definitions;
}
return $this->fieldDefinitions;
}
/**
* Determines if a field has options for a given display.
*
* @param \Drupal\Core\Field\FieldDefinitionInterface $definition
* A field definition.
*
* @return array|null
*/
private function fieldHasDisplayOptions(FieldDefinitionInterface $definition) {
// The display only cares about fields that specify display options.
// Discard base fields that are not rendered through formatters / widgets.
return $definition->getDisplayOptions($this->displayContext);
}
/**
* {@inheritdoc}
*/
public function onDependencyRemoval(array $dependencies) {
$changed = parent::onDependencyRemoval($dependencies);
foreach ($dependencies['config'] as $entity) {
if ($entity->getEntityTypeId() == 'field_config') {
// Remove components for fields that are being deleted.
$this->removeComponent($entity->getName());
unset($this->hidden[$entity->getName()]);
$changed = TRUE;
}
}
foreach ($this->getComponents() as $name => $component) {
if ($renderer = $this->getRenderer($name)) {
if (in_array($renderer->getPluginDefinition()['provider'], $dependencies['module'])) {
// Revert to the defaults if the plugin that supplies the widget or
// formatter depends on a module that is being uninstalled.
$this->setComponent($name);
$changed = TRUE;
}
// Give this component the opportunity to react on dependency removal.
$component_removed_dependencies = $this->getPluginRemovedDependencies($renderer->calculateDependencies(), $dependencies);
if ($component_removed_dependencies) {
if ($renderer->onDependencyRemoval($component_removed_dependencies)) {
// Update component settings to reflect changes.
$component['settings'] = $renderer->getSettings();
$component['third_party_settings'] = [];
foreach ($renderer->getThirdPartyProviders() as $module) {
$component['third_party_settings'][$module] = $renderer->getThirdPartySettings($module);
}
$this->setComponent($name, $component);
$changed = TRUE;
}
// If there are unresolved deleted dependencies left, disable this
// component to avoid the removal of the entire display entity.
if ($this->getPluginRemovedDependencies($renderer->calculateDependencies(), $dependencies)) {
$this->removeComponent($name);
$arguments = [
'@display' => (string) $this->getEntityType()
->getLabel(),
'@id' => $this->id(),
'@name' => $name,
];
$this->getLogger()
->warning("@display '@id': Component '@name' was disabled because its settings depend on removed dependencies.", $arguments);
$changed = TRUE;
}
}
}
}
return $changed;
}
/**
* Returns the plugin dependencies being removed.
*
* The function recursively computes the intersection between all plugin
* dependencies and all removed dependencies.
*
* Note: The two arguments do not have the same structure.
*
* @param array[] $plugin_dependencies
* A list of dependencies having the same structure as the return value of
* ConfigEntityInterface::calculateDependencies().
* @param array[] $removed_dependencies
* A list of dependencies having the same structure as the input argument of
* ConfigEntityInterface::onDependencyRemoval().
*
* @return array
* A recursively computed intersection.
*
* @see \Drupal\Core\Config\Entity\ConfigEntityInterface::calculateDependencies()
* @see \Drupal\Core\Config\Entity\ConfigEntityInterface::onDependencyRemoval()
*/
protected function getPluginRemovedDependencies(array $plugin_dependencies, array $removed_dependencies) {
$intersect = [];
foreach ($plugin_dependencies as $type => $dependencies) {
if ($removed_dependencies[$type]) {
// Config and content entities have the dependency names as keys while
// module and theme dependencies are indexed arrays of dependency names.
// @see \Drupal\Core\Config\ConfigManager::callOnDependencyRemoval()
if (in_array($type, [
'config',
'content',
])) {
$removed = array_intersect_key($removed_dependencies[$type], array_flip($dependencies));
}
else {
$removed = array_values(array_intersect($removed_dependencies[$type], $dependencies));
}
if ($removed) {
$intersect[$type] = $removed;
}
}
}
return $intersect;
}
/**
* Gets the default region.
*
* @return string
* The default region for this display.
*/
protected function getDefaultRegion() {
return 'content';
}
/**
* {@inheritdoc}
*/
public function __sleep() {
// Only store the definition, not external objects or derived data.
$keys = array_keys($this->toArray());
// In addition, we need to keep the entity type and the "is new" status.
$keys[] = 'entityTypeId';
$keys[] = 'enforceIsNew';
// Keep track of the serialized keys, to avoid calling toArray() again in
// __wakeup(). Because of the way __sleep() works, the data has to be
// present in the object to be included in the serialized values.
$keys[] = '_serializedKeys';
// Keep track of the initialization status.
$keys[] = 'initialized';
$this->_serializedKeys = $keys;
return $keys;
}
/**
* {@inheritdoc}
*/
public function __wakeup() {
// Determine what were the properties from toArray() that were saved in
// __sleep().
$keys = $this->_serializedKeys;
unset($this->_serializedKeys);
$values = array_intersect_key(get_object_vars($this), array_flip($keys));
// Run those values through the __construct(), as if they came from a
// regular entity load.
$this->__construct($values, $this->entityTypeId);
}
/**
* Provides the 'system' channel logger service.
*
* @return \Psr\Log\LoggerInterface
* The 'system' channel logger.
*/
protected function getLogger() {
return \Drupal::logger('system');
}
}
Members
Title Sort descending | Modifiers | Object type | Summary | Member alias | Overriden Title | Overrides |
---|---|---|---|---|---|---|
CacheableDependencyTrait::$cacheContexts | protected | property | Cache contexts. | |||
CacheableDependencyTrait::$cacheMaxAge | protected | property | Cache max-age. | |||
CacheableDependencyTrait::$cacheTags | protected | property | Cache tags. | |||
CacheableDependencyTrait::setCacheability | protected | function | Sets cacheability; useful for value object constructors. | |||
ConfigEntityBase::$isUninstalling | private | property | Whether the config is being deleted by the uninstall process. | |||
ConfigEntityBase::$langcode | protected | property | The language code of the entity's default language. | |||
ConfigEntityBase::$originalId | protected | property | The original ID of the configuration entity. | |||
ConfigEntityBase::$third_party_settings | protected | property | ||||
ConfigEntityBase::$trustedData | protected | property | Trust supplied data and not use configuration schema on save. | |||
ConfigEntityBase::$uuid | protected | property | The UUID for this entity. | |||
ConfigEntityBase::$_core | protected | property | ||||
ConfigEntityBase::addDependency | protected | function | Overrides \Drupal\Core\Entity\DependencyTrait:addDependency(). | |||
ConfigEntityBase::createDuplicate | public | function | Creates a duplicate of the entity. | Overrides EntityBase::createDuplicate | 1 | |
ConfigEntityBase::disable | public | function | Disables the configuration entity. | Overrides ConfigEntityInterface::disable | 1 | |
ConfigEntityBase::enable | public | function | Enables the configuration entity. | Overrides ConfigEntityInterface::enable | ||
ConfigEntityBase::get | public | function | Returns the value of a property. | Overrides ConfigEntityInterface::get | ||
ConfigEntityBase::getCacheTagsToInvalidate | public | function | Returns the cache tags that should be used to invalidate caches. | Overrides EntityBase::getCacheTagsToInvalidate | 1 | |
ConfigEntityBase::getConfigDependencyName | public | function | Gets the configuration dependency name. | Overrides EntityBase::getConfigDependencyName | ||
ConfigEntityBase::getConfigManager | protected static | function | Gets the configuration manager. | |||
ConfigEntityBase::getConfigTarget | public | function | Gets the configuration target identifier for the entity. | Overrides EntityBase::getConfigTarget | ||
ConfigEntityBase::getDependencies | public | function | Gets the configuration dependencies. | Overrides ConfigEntityInterface::getDependencies | ||
ConfigEntityBase::getOriginalId | public | function | Gets the original ID. | Overrides EntityBase::getOriginalId | ||
ConfigEntityBase::getThirdPartyProviders | public | function | Gets the list of third parties that store information. | Overrides ThirdPartySettingsInterface::getThirdPartyProviders | ||
ConfigEntityBase::getThirdPartySetting | public | function | Gets the value of a third-party setting. | Overrides ThirdPartySettingsInterface::getThirdPartySetting | ||
ConfigEntityBase::getThirdPartySettings | public | function | Gets all third-party settings of a given module. | Overrides ThirdPartySettingsInterface::getThirdPartySettings | ||
ConfigEntityBase::getTypedConfig | protected | function | Gets the typed config manager. | |||
ConfigEntityBase::hasTrustedData | public | function | Gets whether on not the data is trusted. | Overrides ConfigEntityInterface::hasTrustedData | ||
ConfigEntityBase::invalidateTagsOnDelete | protected static | function | Override to never invalidate the individual entities' cache tags; the config system already invalidates them. |
Overrides EntityBase::invalidateTagsOnDelete | ||
ConfigEntityBase::invalidateTagsOnSave | protected | function | Override to never invalidate the entity's cache tag; the config system already invalidates it. |
Overrides EntityBase::invalidateTagsOnSave | ||
ConfigEntityBase::isInstallable | public | function | Checks whether this entity is installable. | Overrides ConfigEntityInterface::isInstallable | 2 | |
ConfigEntityBase::isNew | public | function | Overrides Entity::isNew(). | Overrides EntityBase::isNew | ||
ConfigEntityBase::isUninstalling | public | function | Returns whether this entity is being changed during the uninstall process. | Overrides ConfigEntityInterface::isUninstalling | ||
ConfigEntityBase::preDelete | public static | function | Acts on entities before they are deleted and before hooks are invoked. | Overrides EntityBase::preDelete | 8 | |
ConfigEntityBase::save | public | function | Saves an entity permanently. | Overrides EntityBase::save | 2 | |
ConfigEntityBase::set | public | function | Sets the value of a property. | Overrides ConfigEntityInterface::set | ||
ConfigEntityBase::setOriginalId | public | function | Sets the original ID. | Overrides EntityBase::setOriginalId | ||
ConfigEntityBase::setStatus | public | function | Sets the status of the configuration entity. | Overrides ConfigEntityInterface::setStatus | ||
ConfigEntityBase::setThirdPartySetting | public | function | Sets the value of a third-party setting. | Overrides ThirdPartySettingsInterface::setThirdPartySetting | ||
ConfigEntityBase::setUninstalling | public | function | ||||
ConfigEntityBase::sort | public static | function | Helper callback for uasort() to sort configuration entities by weight and label. | 6 | ||
ConfigEntityBase::status | public | function | Returns whether the configuration entity is enabled. | Overrides ConfigEntityInterface::status | 4 | |
ConfigEntityBase::toUrl | public | function | Gets the URL object for the entity. | Overrides EntityBase::toUrl | ||
ConfigEntityBase::trustData | public | function | Sets that the data should be trusted. | Overrides ConfigEntityInterface::trustData | ||
ConfigEntityBase::unsetThirdPartySetting | public | function | Unsets a third-party setting. | Overrides ThirdPartySettingsInterface::unsetThirdPartySetting | ||
DependencySerializationTrait::$_entityStorages | protected | property | ||||
DependencySerializationTrait::$_serviceIds | protected | property | ||||
DependencySerializationTrait::__sleep | public | function | Aliased as: traitSleep | 1 | ||
DependencyTrait::$dependencies | protected | property | The object's dependencies. | |||
DependencyTrait::addDependencies | protected | function | Adds multiple dependencies. | |||
DependencyTrait::addDependency | protected | function | Adds a dependency. | Aliased as: addDependencyTrait | ||
EntityBase::$enforceIsNew | protected | property | Boolean indicating whether the entity should be forced to be new. | |||
EntityBase::$entityTypeId | protected | property | The entity type. | |||
EntityBase::$typedData | protected | property | A typed data object wrapping this entity. | |||
EntityBase::access | public | function | Checks data value access. | Overrides AccessibleInterface::access | 1 | |
EntityBase::bundle | public | function | Gets the bundle of the entity. | Overrides EntityInterface::bundle | 1 | |
EntityBase::create | public static | function | Constructs a new entity object, without permanently saving it. | Overrides EntityInterface::create | 2 | |
EntityBase::delete | public | function | Deletes an entity permanently. | Overrides EntityInterface::delete | 1 | |
EntityBase::enforceIsNew | public | function | Enforces an entity to be new. | Overrides EntityInterface::enforceIsNew | ||
EntityBase::entityTypeBundleInfo | protected | function | Gets the entity type bundle info service. | |||
EntityBase::entityTypeManager | protected | function | Gets the entity type manager. | |||
EntityBase::getCacheContexts | public | function | The cache contexts associated with this object. | Overrides CacheableDependencyTrait::getCacheContexts | ||
EntityBase::getCacheMaxAge | public | function | The maximum age for which this object may be cached. | Overrides CacheableDependencyTrait::getCacheMaxAge | ||
EntityBase::getCacheTags | public | function | The cache tags associated with this object. | Overrides CacheableDependencyTrait::getCacheTags | ||
EntityBase::getConfigDependencyKey | public | function | Gets the key that is used to store configuration dependencies. | Overrides EntityInterface::getConfigDependencyKey | ||
EntityBase::getEntityType | public | function | Gets the entity type definition. | Overrides EntityInterface::getEntityType | ||
EntityBase::getEntityTypeId | public | function | Gets the ID of the type of the entity. | Overrides EntityInterface::getEntityTypeId | ||
EntityBase::getListCacheTagsToInvalidate | protected | function | The list cache tags to invalidate for this entity. | |||
EntityBase::getTypedData | public | function | Gets a typed data object for this entity object. | Overrides EntityInterface::getTypedData | ||
EntityBase::getTypedDataClass | private | function | Returns the typed data class name for this entity. | |||
EntityBase::hasLinkTemplate | public | function | Indicates if a link template exists for a given key. | Overrides EntityInterface::hasLinkTemplate | ||
EntityBase::label | public | function | Gets the label of the entity. | Overrides EntityInterface::label | 6 | |
EntityBase::language | public | function | Gets the language of the entity. | Overrides EntityInterface::language | 1 | |
EntityBase::languageManager | protected | function | Gets the language manager. | |||
EntityBase::linkTemplates | protected | function | Gets an array link templates. | 1 | ||
EntityBase::load | public static | function | Loads an entity. | Overrides EntityInterface::load | ||
EntityBase::loadMultiple | public static | function | Loads one or more entities. | Overrides EntityInterface::loadMultiple | ||
EntityBase::postCreate | public | function | Acts on a created entity before hooks are invoked. | Overrides EntityInterface::postCreate | 5 | |
EntityBase::postDelete | public static | function | Acts on deleted entities before the delete hook is invoked. | Overrides EntityInterface::postDelete | 17 | |
EntityBase::postLoad | public static | function | Acts on loaded entities. | Overrides EntityInterface::postLoad | 3 | |
EntityBase::postSave | public | function | Acts on a saved entity before the insert or update hook is invoked. | Overrides EntityInterface::postSave | 13 | |
EntityBase::preCreate | public static | function | Changes the values of an entity before it is created. | Overrides EntityInterface::preCreate | 6 | |
EntityBase::referencedEntities | public | function | Gets a list of entities referenced by this entity. | Overrides EntityInterface::referencedEntities | 1 | |
EntityBase::toLink | public | function | Generates the HTML for a link to this entity. | Overrides EntityInterface::toLink | ||
EntityBase::uriRelationships | public | function | Gets a list of URI relationships supported by this entity. | Overrides EntityInterface::uriRelationships | ||
EntityBase::urlRouteParameters | protected | function | Gets an array of placeholders for this entity. | 2 | ||
EntityBase::uuid | public | function | Gets the entity UUID (Universally Unique Identifier). | Overrides EntityInterface::uuid | 1 | |
EntityBase::uuidGenerator | protected | function | Gets the UUID generator. | |||
EntityDisplayBase::$bundle | protected | property | Bundle to be displayed. | |||
EntityDisplayBase::$content | protected | property | List of component display options, keyed by component name. | |||
EntityDisplayBase::$displayContext | protected | property | Context in which this entity will be used (e.g. 'view', 'form'). | 2 | ||
EntityDisplayBase::$fieldDefinitions | protected | property | A list of field definitions eligible for configuration in this display. | |||
EntityDisplayBase::$hidden | protected | property | List of components that are set to be hidden. | |||
EntityDisplayBase::$id | protected | property | Unique ID for the config entity. | |||
EntityDisplayBase::$initialized | protected | property | A boolean indicating whether or not this display has been initialized. | |||
EntityDisplayBase::$mode | protected | property | View or form mode to be displayed. | |||
EntityDisplayBase::$originalMode | protected | property | The original view or form mode that was requested. | |||
EntityDisplayBase::$pluginManager | protected | property | The plugin manager used by this entity type. | |||
EntityDisplayBase::$plugins | protected | property | The plugin objects used for this display, keyed by field name. | |||
EntityDisplayBase::$renderer | protected | property | The renderer. | |||
EntityDisplayBase::$status | protected | property | Whether this display is enabled or not. | Overrides ConfigEntityBase::$status | ||
EntityDisplayBase::$targetEntityType | protected | property | Entity type to be displayed. | |||
EntityDisplayBase::calculateDependencies | public | function | Calculates dependencies and stores them in the dependency property. | Overrides ConfigEntityBase::calculateDependencies | 1 | |
EntityDisplayBase::createCopy | public | function | Creates a duplicate of the entity display object on a different view mode. | Overrides EntityDisplayInterface::createCopy | 1 | |
EntityDisplayBase::CUSTOM_MODE | constant | The mode used to render entities with arbitrary display options. | ||||
EntityDisplayBase::fieldHasDisplayOptions | private | function | Determines if a field has options for a given display. | |||
EntityDisplayBase::getComponent | public | function | Gets the display options set for a component. | Overrides EntityDisplayInterface::getComponent | 1 | |
EntityDisplayBase::getComponents | public | function | Gets the display options for all components. | Overrides EntityDisplayInterface::getComponents | ||
EntityDisplayBase::getDefaultRegion | protected | function | Gets the default region. | 1 | ||
EntityDisplayBase::getFieldDefinition | protected | function | Gets the field definition of a field. | |||
EntityDisplayBase::getFieldDefinitions | protected | function | Gets the definitions of the fields that are candidate for display. | |||
EntityDisplayBase::getHighestWeight | public | function | Gets the highest weight of the components in the display. | Overrides EntityDisplayInterface::getHighestWeight | ||
EntityDisplayBase::getLogger | protected | function | Provides the 'system' channel logger service. | |||
EntityDisplayBase::getMode | public | function | Gets the view or form mode to be displayed. | Overrides EntityDisplayInterface::getMode | ||
EntityDisplayBase::getOriginalMode | public | function | Gets the original view or form mode that was requested. | Overrides EntityDisplayInterface::getOriginalMode | ||
EntityDisplayBase::getPluginRemovedDependencies | protected | function | Returns the plugin dependencies being removed. | |||
EntityDisplayBase::getTargetBundle | public | function | Gets the bundle to be displayed. | Overrides EntityDisplayInterface::getTargetBundle | ||
EntityDisplayBase::getTargetEntityTypeId | public | function | Gets the entity type for which this display is used. | Overrides EntityDisplayInterface::getTargetEntityTypeId | ||
EntityDisplayBase::id | public | function | Gets the identifier. | Overrides EntityBase::id | ||
EntityDisplayBase::init | protected | function | Initializes the display. | |||
EntityDisplayBase::onDependencyRemoval | public | function | Informs the entity that entities it depends on will be deleted. | Overrides ConfigEntityBase::onDependencyRemoval | 1 | |
EntityDisplayBase::preSave | public | function | Acts on an entity before the presave hook is invoked. | Overrides ConfigEntityBase::preSave | 1 | |
EntityDisplayBase::removeComponent | public | function | Sets a component to be hidden. | Overrides EntityDisplayInterface::removeComponent | ||
EntityDisplayBase::setComponent | public | function | Sets the display options for a component. | Overrides EntityDisplayInterface::setComponent | 1 | |
EntityDisplayBase::setTargetBundle | public | function | Sets the bundle to be displayed. | Overrides EntityDisplayInterface::setTargetBundle | ||
EntityDisplayBase::toArray | public | function | Gets an array of all property values. | Overrides ConfigEntityBase::toArray | ||
EntityDisplayBase::__construct | public | function | Constructs an Entity object. | Overrides ConfigEntityBase::__construct | 2 | |
EntityDisplayBase::__sleep | public | function | Overrides ConfigEntityBase::__sleep | |||
EntityDisplayBase::__wakeup | public | function | Overrides DependencySerializationTrait::__wakeup | |||
EntityDisplayInterface::getRenderer | public | function | Gets the renderer plugin for a field (e.g. widget, formatter). | 3 | ||
PluginDependencyTrait::calculatePluginDependencies | protected | function | Calculates and adds dependencies of a specific plugin instance. | 1 | ||
PluginDependencyTrait::getPluginDependencies | protected | function | Calculates and returns dependencies of a specific plugin instance. | |||
PluginDependencyTrait::moduleHandler | protected | function | Wraps the module handler. | 1 | ||
PluginDependencyTrait::themeHandler | protected | function | Wraps the theme handler. | 1 | ||
RefinableCacheableDependencyTrait::addCacheableDependency | public | function | 1 | |||
RefinableCacheableDependencyTrait::addCacheContexts | public | function | ||||
RefinableCacheableDependencyTrait::addCacheTags | public | function | ||||
RefinableCacheableDependencyTrait::mergeCacheMaxAge | public | function | ||||
SynchronizableEntityTrait::$isSyncing | protected | property | Is entity being created updated or deleted through synchronization process. | |||
SynchronizableEntityTrait::isSyncing | public | function | ||||
SynchronizableEntityTrait::setSyncing | public | function |
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.