W3cubDocs

/Drupal 8

protected function EntityDisplayBase::getFieldDefinitions

protected EntityDisplayBase::getFieldDefinitions()

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

File

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

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::entityManager()->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, array($this, 'fieldHasDisplayOptions'));
    }
    $this->fieldDefinitions = $definitions;
  }

  return $this->fieldDefinitions;
}

© 2001–2016 by the original authors
Licensed under the GNU General Public License, version 2 and later.
Drupal is a registered trademark of Dries Buytaert.
https://api.drupal.org/api/drupal/core!lib!Drupal!Core!Entity!EntityDisplayBase.php/function/EntityDisplayBase::getFieldDefinitions/8.1.x