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;
}
doc_Drupal
2016-10-29 09:05:16
Comments
Leave a Comment

Please login to continue.