function EntityDisplayBase::getFieldDefinitions

Same name in other branches
  1. 9 core/lib/Drupal/Core/Entity/EntityDisplayBase.php \Drupal\Core\Entity\EntityDisplayBase::getFieldDefinitions()
  2. 8.9.x core/lib/Drupal/Core/Entity/EntityDisplayBase.php \Drupal\Core\Entity\EntityDisplayBase::getFieldDefinitions()
  3. 10 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 416

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;
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.