interface EntityEmbedDisplayInterface in Entity Embed 8
Defines the interface for Entity Embed Display plugins.
The abstraction layer provided by this plugin type may seem unnecessary at first sight. Why not just allow users of Entity Embed to choose a view mode (and its corresponding bundle-specific view display)?
There are two reasons:
- It may be necessary to have metadata (a description for example) that is specific to a particular instance of embedding an entity. You may reference the same entity many times, but each time you want different metadata (a different description). If Entity Embed only allowed one to embed using a particular view mode, this would not be possible, since every embed would need to be rendered exactly the same.
- Some entities can not be rendered by default because they do not have a view builder. (particularly: the File entity which is crucial for embedding of media). To still be able to embed them, an Entity Embed Display plugin can be provided.
The ability to embed an entity using a view mode/display is then just one of many Entity Embed Display plugins. It is available for all entities that can be rendered (that have a view builder).
Hierarchy
- interface \Drupal\Component\Plugin\ConfigurableInterface; interface \Drupal\Component\Plugin\DependentPluginInterface; interface \Drupal\Core\Plugin\PluginFormInterface; interface \Drupal\Component\Plugin\PluginInspectionInterface
- interface \Drupal\entity_embed\EntityEmbedDisplay\EntityEmbedDisplayInterface
Expanded class hierarchy of EntityEmbedDisplayInterface
All classes that implement EntityEmbedDisplayInterface
See also
\Drupal\Core\Entity\Entity\EntityViewMode
\Drupal\Core\Entity\Entity\EntityViewDisplay
\Drupal\Core\Entity\EntityViewBuilderInterface
\Drupal\entity_embed\Annotation\EntityEmbedDisplay
\Drupal\entity_embed\EntityEmbedDisplay\EntityEmbedDisplayBase
\Drupal\entity_embed\EntityEmbedDisplay\EntityEmbedDisplayManager
1 file declares its use of EntityEmbedDisplayInterface
- MediaImageDecorator.php in src/
Plugin/ entity_embed/ EntityEmbedDisplay/ MediaImageDecorator.php
File
- src/
EntityEmbedDisplay/ EntityEmbedDisplayInterface.php, line 45
Namespace
Drupal\entity_embed\EntityEmbedDisplayView source
interface EntityEmbedDisplayInterface extends ConfigurableInterface, DependentPluginInterface, PluginFormInterface, PluginInspectionInterface {
/**
* Indicates whether this Entity Embed display can be used.
*
* This method allows base implementations to add general access restrictions
* that should apply to all extending Entity Embed display plugins.
*
* @param \Drupal\Core\Session\AccountInterface $account
* (optional) The user for which to check access, or NULL to check access
* for the current user. Defaults to NULL.
*
* @return \Drupal\Core\Access\AccessResultInterface
* The access result.
*/
public function access(AccountInterface $account = NULL);
/**
* Builds the renderable array for this Entity Embed display plugin.
*
* @return array
* A renderable array representing the content of the embedded entity.
*/
public function build();
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
ConfigurableInterface:: |
public | function | Gets default configuration for this plugin. | 11 |
ConfigurableInterface:: |
public | function | Gets this plugin's configuration. | 12 |
ConfigurableInterface:: |
public | function | Sets the configuration for this plugin instance. | 12 |
DependentPluginInterface:: |
public | function | Calculates dependencies for the configured plugin. | 19 |
EntityEmbedDisplayInterface:: |
public | function | Indicates whether this Entity Embed display can be used. | 2 |
EntityEmbedDisplayInterface:: |
public | function | Builds the renderable array for this Entity Embed display plugin. | 2 |
PluginFormInterface:: |
public | function | Form constructor. | 36 |
PluginFormInterface:: |
public | function | Form submission handler. | 32 |
PluginFormInterface:: |
public | function | Form validation handler. | 18 |
PluginInspectionInterface:: |
public | function | Gets the definition of the plugin implementation. | 4 |
PluginInspectionInterface:: |
public | function | Gets the plugin_id of the plugin instance. | 2 |