You are here

public function EntityEmbedDisplayBase::getEntityTypeFromContext in Entity Embed 8

Gets the entity type from the current context.

Return value

string The entity type id.

4 calls to EntityEmbedDisplayBase::getEntityTypeFromContext()
EntityEmbedDisplayBase::isValidEntityType in src/EntityEmbedDisplay/EntityEmbedDisplayBase.php
Validates that this display plugin applies to the current entity type.
EntityReferenceFieldFormatter::getFieldDefinition in src/Plugin/entity_embed/EntityEmbedDisplay/EntityReferenceFieldFormatter.php
Get the FieldDefinition object required to render this field's formatter.
EntityReferenceFieldFormatter::isApplicableFieldFormatter in src/Plugin/entity_embed/EntityEmbedDisplay/EntityReferenceFieldFormatter.php
Checks if the field formatter is applicable.
ImageFieldFormatter::isValidImage in src/Plugin/entity_embed/EntityEmbedDisplay/ImageFieldFormatter.php
Checks if the image is valid.

File

src/EntityEmbedDisplay/EntityEmbedDisplayBase.php, line 262

Class

EntityEmbedDisplayBase
Defines a base Entity Embed Display implementation.

Namespace

Drupal\entity_embed\EntityEmbedDisplay

Code

public function getEntityTypeFromContext() {
  if ($this
    ->hasContextValue('entity')) {
    return $this
      ->getContextValue('entity')
      ->getEntityTypeId();
  }
  else {
    return $this
      ->getContextValue('entity_type');
  }
}