Drupal 8  8.0.2
EntityDisplayBase Class Reference
Inheritance diagram for EntityDisplayBase:

Public Member Functions

 __construct (array $values, $entity_type)
 
 getTargetEntityTypeId ()
 
 getMode ()
 
 getOriginalMode ()
 
 getTargetBundle ()
 
 setTargetBundle ($bundle)
 
 id ()
 
 preSave (EntityStorageInterface $storage, $update=TRUE)
 
 calculateDependencies ()
 
 toArray ()
 
 createCopy ($mode)
 
 getComponents ()
 
 getComponent ($name)
 
 setComponent ($name, array $options=array())
 
 removeComponent ($name)
 
 getHighestWeight ()
 
 onDependencyRemoval (array $dependencies)
 
 __sleep ()
 
 __wakeup ()
 
- Public Member Functions inherited from ConfigEntityBase
 __construct (array $values, $entity_type)
 
 getOriginalId ()
 
 setOriginalId ($id)
 
 isNew ()
 
 get ($property_name)
 
 set ($property_name, $value)
 
 enable ()
 
 disable ()
 
 setStatus ($status)
 
 status ()
 
 setSyncing ($syncing)
 
 isSyncing ()
 
 setUninstalling ($uninstalling)
 
 isUninstalling ()
 
 createDuplicate ()
 
 preSave (EntityStorageInterface $storage)
 
 calculateDependencies ()
 
 urlInfo ($rel= 'edit-form', array $options=[])
 
 url ($rel= 'edit-form', $options=array())
 
 link ($text=NULL, $rel= 'edit-form', array $options=[])
 
 toUrl ($rel= 'edit-form', array $options=[])
 
 getCacheTagsToInvalidate ()
 
 getDependencies ()
 
 getConfigDependencyName ()
 
 getConfigTarget ()
 
 onDependencyRemoval (array $dependencies)
 
 setThirdPartySetting ($module, $key, $value)
 
 getThirdPartySetting ($module, $key, $default=NULL)
 
 getThirdPartySettings ($module)
 
 unsetThirdPartySetting ($module, $key)
 
 getThirdPartyProviders ()
 
 isInstallable ()
 
 trustData ()
 
 hasTrustedData ()
 
 save ()
 
- Public Member Functions inherited from Entity
 __construct (array $values, $entity_type)
 
 id ()
 
 uuid ()
 
 isNew ()
 
 enforceIsNew ($value=TRUE)
 
 getEntityTypeId ()
 
 bundle ()
 
 label ()
 
 urlInfo ($rel= 'canonical', array $options=[])
 
 toUrl ($rel= 'canonical', array $options=[])
 
 hasLinkTemplate ($rel)
 
 link ($text=NULL, $rel= 'canonical', array $options=[])
 
 toLink ($text=NULL, $rel= 'canonical', array $options=[])
 
 url ($rel= 'canonical', $options=array())
 
 uriRelationships ()
 
 access ($operation, AccountInterface $account=NULL, $return_as_object=FALSE)
 
 language ()
 
 save ()
 
 delete ()
 
 createDuplicate ()
 
 getEntityType ()
 
 preSave (EntityStorageInterface $storage)
 
 postSave (EntityStorageInterface $storage, $update=TRUE)
 
 postCreate (EntityStorageInterface $storage)
 
 referencedEntities ()
 
 getCacheContexts ()
 
 getCacheTagsToInvalidate ()
 
 getCacheTags ()
 
 getCacheMaxAge ()
 
 getOriginalId ()
 
 setOriginalId ($id)
 
 toArray ()
 
 getTypedData ()
 
 __sleep ()
 
 getConfigDependencyKey ()
 
 getConfigDependencyName ()
 
 getConfigTarget ()
 
- Public Member Functions inherited from RefinableCacheableDependencyInterface
 addCacheContexts (array $cache_contexts)
 
 addCacheTags (array $cache_tags)
 
 mergeCacheMaxAge ($max_age)
 
 addCacheableDependency ($other_object)
 
- Public Member Functions inherited from EntityDisplayInterface
 getRenderer ($field_name)
 
- Public Member Functions inherited from EntityWithPluginCollectionInterface
 getPluginCollections ()
 

Data Fields

const CUSTOM_MODE = '_custom'
 

Protected Member Functions

 init ()
 
 getFieldDefinition ($field_name)
 
 getFieldDefinitions ()
 
 getPluginRemovedDependencies (array $plugin_dependencies, array $removed_dependencies)
 
 getLogger ()
 
- Protected Member Functions inherited from ConfigEntityBase
 getTypedConfig ()
 
 addDependency ($type, $name)
 
 invalidateTagsOnSave ($update)
 
- Protected Member Functions inherited from Entity
 entityManager ()
 
 entityTypeManager ()
 
 languageManager ()
 
 uuidGenerator ()
 
 linkTemplates ()
 
 urlRouteParameters ($rel)
 
 invalidateTagsOnSave ($update)
 

Protected Attributes

 $id
 
 $targetEntityType
 
 $bundle
 
 $fieldDefinitions
 
 $mode = self::CUSTOM_MODE
 
 $status
 
 $content = array()
 
 $hidden = array()
 
 $originalMode
 
 $plugins = array()
 
 $displayContext
 
 $pluginManager
 
 $renderer
 
- Protected Attributes inherited from ConfigEntityBase
 $originalId
 
 $pluginConfigKey
 
 $status = TRUE
 
 $uuid
 
 $langcode = 'en'
 
 $third_party_settings = array()
 
 $_core = []
 
 $trustedData = FALSE
 
- Protected Attributes inherited from Entity
 $entityTypeId
 
 $enforceIsNew
 
 $typedData
 

Additional Inherited Members

- Static Public Member Functions inherited from ConfigEntityBase
static sort (ConfigEntityInterface $a, ConfigEntityInterface $b)
 
- Static Public Member Functions inherited from Entity
static preCreate (EntityStorageInterface $storage, array &$values)
 
static preDelete (EntityStorageInterface $storage, array $entities)
 
static postDelete (EntityStorageInterface $storage, array $entities)
 
static postLoad (EntityStorageInterface $storage, array &$entities)
 
static load ($id)
 
static loadMultiple (array $ids=NULL)
 
static create (array $values=array())
 
- Static Protected Member Functions inherited from ConfigEntityBase
static invalidateTagsOnDelete (EntityTypeInterface $entity_type, array $entities)
 
static getConfigManager ()
 
- Static Protected Member Functions inherited from Entity
static invalidateTagsOnDelete (EntityTypeInterface $entity_type, array $entities)
 

Detailed Description

Provides a common base class for entity view and form displays.

Constructor & Destructor Documentation

__construct ( array  $values,
  $entity_type 
)

{}

References Entity\entityManager(), EntityDisplayBase\init(), and Drupal\service().

Referenced by EntityDisplayBase\__wakeup().

Here is the call graph for this function:

Here is the caller graph for this function:

Member Function Documentation

__sleep ( )

{}

References EntityDisplayBase\toArray().

Here is the call graph for this function:

__wakeup ( )

{}

References EntityDisplayBase\__construct().

Here is the call graph for this function:

calculateDependencies ( )

{Calculates dependencies and stores them in the dependency property.

Returns
$this
See Also
}

Implements ConfigEntityInterface.

References ConfigEntityBase\addDependency(), Entity\bundle(), Entity\entityManager(), EntityInterface\getEntityTypeId(), and Drupal\moduleHandler().

Here is the call graph for this function:

createCopy (   $mode)

{Creates a duplicate of the entity display object on a different view mode.The new object necessarily has the same $targetEntityType and $bundle properties than the original one.

Parameters
string$view_modeThe view mode for the new object.
Returns
static A duplicate of this object with the given view mode.
}

Implements EntityDisplayInterface.

References ConfigEntityBase\createDuplicate().

Here is the call graph for this function:

getComponent (   $name)

{Gets the display options set for a component.

Parameters
string$nameThe name of the component.
Returns
array|null The display options for the component, or NULL if the component is not displayed.
}

Implements EntityDisplayInterface.

Referenced by EntityFormDisplay\getRenderer(), EntityViewDisplay\getRenderer(), and EntityFormDisplay\processForm().

Here is the caller graph for this function:

getComponents ( )

{Gets the display options for all components.

Returns
array The array of display options, keyed by component name.
}

Implements EntityDisplayInterface.

Referenced by EntityFormDisplay\buildForm(), EntityViewDisplay\getPluginCollections(), EntityFormDisplay\getPluginCollections(), EntityDisplayBase\onDependencyRemoval(), and EntityFormDisplay\processForm().

Here is the caller graph for this function:

getFieldDefinition (   $field_name)
protected

Gets the field definition of a field.

References EntityDisplayBase\getFieldDefinitions().

Referenced by EntityFormDisplay\buildForm(), EntityViewDisplay\getPluginCollections(), EntityFormDisplay\getPluginCollections(), EntityFormDisplay\getRenderer(), EntityViewDisplay\getRenderer(), and EntityDisplayBase\setComponent().

Here is the call graph for this function:

Here is the caller graph for this function:

getFieldDefinitions ( )
protected

Gets the definitions of the fields that are candidate for display.

References Entity\bundle(), and Drupal\entityManager().

Referenced by EntityDisplayBase\getFieldDefinition(), EntityDisplayBase\init(), and EntityDisplayBase\toArray().

Here is the call graph for this function:

Here is the caller graph for this function:

getHighestWeight ( )

{Gets the highest weight of the components in the display.

Returns
int|null The highest weight of the components in the display, or NULL if the display is empty.
}

Implements EntityDisplayInterface.

References Entity\bundle(), and Drupal\moduleHandler().

Referenced by EntityDisplayBase\setComponent().

Here is the call graph for this function:

Here is the caller graph for this function:

getLogger ( )
protected

Provides the 'system' channel logger service.

Returns
The 'system' channel logger.

Referenced by EntityDisplayBase\onDependencyRemoval().

Here is the caller graph for this function:

getMode ( )

{Gets the view or form mode to be displayed.

Returns
string The mode to be displayed.
}

Implements EntityDisplayInterface.

getOriginalMode ( )

{Gets the original view or form mode that was requested.

Returns
string The original mode that was requested.
}

Implements EntityDisplayInterface.

getPluginRemovedDependencies ( array  $plugin_dependencies,
array  $removed_dependencies 
)
protected

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.

Parameters
array[]$plugin_dependencies A list of dependencies having the same structure as the return value of ConfigEntityInterface::calculateDependencies().
array[]$removed_dependencies A list of dependencies having the same structure as the input argument of ConfigEntityInterface::onDependencyRemoval().
Returns
array A recursively computed intersection.
See Also
::calculateDependencies()
::onDependencyRemoval()

Referenced by EntityDisplayBase\onDependencyRemoval().

Here is the caller graph for this function:

getTargetBundle ( )

{Gets the bundle to be displayed.

Returns
string The bundle to be displayed.
}

Implements EntityDisplayInterface.

getTargetEntityTypeId ( )

{Gets the entity type for which this display is used.

Returns
string The entity type id.
}

Implements EntityDisplayInterface.

id ( )

{Gets the identifier.

Returns
string|int|null The entity identifier, or NULL if the object does not yet have an identifier.
}

Implements EntityInterface.

References Entity\bundle().

Referenced by EntityDisplayBase\onDependencyRemoval().

Here is the call graph for this function:

Here is the caller graph for this function:

init ( )
protected

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.

References Entity\bundle(), Drupal\entityManager(), and EntityDisplayBase\getFieldDefinitions().

Referenced by EntityDisplayBase\__construct().

Here is the call graph for this function:

Here is the caller graph for this function:

onDependencyRemoval ( array  $dependencies)

{Informs the entity that entities it depends on will be deleted.This method allows configuration entities to remove dependencies instead of being deleted themselves. Configuration entities can use this method to avoid being unnecessarily deleted during an extension uninstallation. For example, entity displays remove references to widgets and formatters if the plugin that supplies them depends on a module that is being uninstalled.If this method returns TRUE then the entity needs to be re-saved by the caller for the changes to take effect. Implementations should not save the entity.

Parameters
array$dependenciesAn array of dependencies that will be deleted keyed by dependency type. Dependency types are, for example, entity, module and theme.
Returns
bool TRUE if the entity has changed, FALSE if not.
bool TRUE if the entity has been changed as a result, FALSE if not.
See Also
::preDelete()
::uninstall()
::onDependencyRemoval()
}

Implements ConfigEntityInterface.

References EntityDisplayBase\getComponents(), Entity\getEntityType(), EntityDisplayBase\getLogger(), EntityDisplayBase\getPluginRemovedDependencies(), EntityDisplayInterface\getRenderer(), EntityDisplayBase\id(), EntityDisplayBase\removeComponent(), and EntityDisplayBase\setComponent().

Here is the call graph for this function:

preSave ( EntityStorageInterface  $storage,
  $update = TRUE 
)

{}

removeComponent (   $name)

{Sets a component to be hidden.

Parameters
string$nameThe name of the component.
Returns
$this
}

Implements EntityDisplayInterface.

Referenced by EntityDisplayBase\onDependencyRemoval().

Here is the caller graph for this function:

setComponent (   $name,
array  $options = array() 
)

{Sets the display options for a component.

Parameters
string$nameThe name of the component.
array$optionsThe display options.
Returns
$this
}

Implements EntityDisplayInterface.

References EntityDisplayBase\getFieldDefinition(), and EntityDisplayBase\getHighestWeight().

Referenced by EntityDisplayBase\onDependencyRemoval().

Here is the call graph for this function:

Here is the caller graph for this function:

setTargetBundle (   $bundle)

{Sets the bundle to be displayed.

Parameters
string$bundleThe bundle to be displayed.
Returns
$this
}

Implements EntityDisplayInterface.

References ConfigEntityBase\set().

Here is the call graph for this function:

toArray ( )

{Gets an array of all property values.

Returns
mixed[] An array of property values, keyed by property name.
}

Implements EntityInterface.

References EntityDisplayBase\getFieldDefinitions().

Referenced by EntityDisplayBase\__sleep().

Here is the call graph for this function:

Here is the caller graph for this function:

Field Documentation

const CUSTOM_MODE = '_custom'

The 'mode' for runtime EntityDisplay objects used to render entities with arbitrary display options rather than a configured view mode or form mode.

Todo:
Prevent creation of a mode with this ID https://www.drupal.org/node/2410727

The documentation for this class was generated from the following file: