You are here

protected function EntityField::getFieldDefinition in Chaos Tool Suite (ctools) 8.3

Gets the field definition.

Return value

\Drupal\Core\Field\FieldDefinitionInterface The field definition.

2 calls to EntityField::getFieldDefinition()
EntityField::blockAccess in modules/ctools_block/src/Plugin/Block/EntityField.php
Indicates whether the block should be shown.
EntityField::getFormatter in modules/ctools_block/src/Plugin/Block/EntityField.php
Gets the formatter object.

File

modules/ctools_block/src/Plugin/Block/EntityField.php, line 301

Class

EntityField
Provides a block to a field on an entity.

Namespace

Drupal\ctools_block\Plugin\Block

Code

protected function getFieldDefinition() {
  if (empty($this->fieldDefinition)) {
    $field_map = $this->entityFieldManager
      ->getFieldMap();
    $bundle = reset($field_map[$this->entityTypeId][$this->fieldName]['bundles']);
    $field_definitions = $this->entityFieldManager
      ->getFieldDefinitions($this->entityTypeId, $bundle);
    $this->fieldDefinition = $field_definitions[$this->fieldName];
  }
  return $this->fieldDefinition;
}