You are here

protected function EntityDisplayBase::getFieldDefinitions in Drupal 10

Same name and namespace in other branches
  1. 8 core/lib/Drupal/Core/Entity/EntityDisplayBase.php \Drupal\Core\Entity\EntityDisplayBase::getFieldDefinitions()
  2. 9 core/lib/Drupal/Core/Entity/EntityDisplayBase.php \Drupal\Core\Entity\EntityDisplayBase::getFieldDefinitions()

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

3 calls to EntityDisplayBase::getFieldDefinitions()
EntityDisplayBase::getFieldDefinition in core/lib/Drupal/Core/Entity/EntityDisplayBase.php
Gets the field definition of a field.
EntityDisplayBase::init in core/lib/Drupal/Core/Entity/EntityDisplayBase.php
Initializes the display.
EntityDisplayBase::toArray in core/lib/Drupal/Core/Entity/EntityDisplayBase.php
Gets an array of all property values.

File

core/lib/Drupal/Core/Entity/EntityDisplayBase.php, line 400

Class

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

Namespace

Drupal\Core\Entity

Code

protected function getFieldDefinitions() {
  if (!isset($this->fieldDefinitions)) {
    $definitions = \Drupal::service('entity_field.manager')
      ->getFieldDefinitions($this->targetEntityType, $this->bundle);

    // For "official" view modes and form modes, ignore fields whose
    // definition states they should not be displayed.
    if ($this->mode !== static::CUSTOM_MODE) {
      $definitions = array_filter($definitions, [
        $this,
        'fieldHasDisplayOptions',
      ]);
    }
    $this->fieldDefinitions = $definitions;
  }
  return $this->fieldDefinitions;
}