Skip to main content
Drupal API
User account menu
  • Log in

Breadcrumb

  1. Drupal Core 11.1.x
  2. EntityDisplayBase.php

function 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 415

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

API Navigation

  • Drupal Core 11.1.x
  • Topics
  • Classes
  • Functions
  • Constants
  • Globals
  • Files
  • Namespaces
  • Deprecated
  • Services
RSS feed
Powered by Drupal