Same name and namespace in other branches
  1. 8.x-2.x src/Plugin/Field/FieldFormatter/ColorFieldFormatterCss.php \Drupal\color_field\Plugin\Field\FieldFormatter\ColorFieldFormatterCss::getTokenType() 1 comment

Gets the token type of the target entity.

If the token entity mapper service is available, it will be used to get the token type. If that service is not available, the target entity type id will be used as a fallback.

Return value

string Token type of the target entity.

1 call to ColorFieldFormatterCss::getTokenType()
ColorFieldFormatterCss::settingsForm in src/Plugin/Field/FieldFormatter/ColorFieldFormatterCss.php

File

src/Plugin/Field/FieldFormatter/ColorFieldFormatterCss.php, line 289

Class

ColorFieldFormatterCss
Plugin implementation of the color_field css declaration formatter.

Namespace

Drupal\color_field\Plugin\Field\FieldFormatter

Code

protected function getTokenType() : string {
    $entity_type_id = $this->fieldDefinition
        ->getTargetEntityTypeId();
    if (!$this->tokenEntityMapper) {
        return $entity_type_id;
    }
    return $this->tokenEntityMapper
        ->getTokenTypeForEntityType($entity_type_id, TRUE);
}