function EntityDisplayBase::toArray

Same name in other branches
  1. 8.9.x core/lib/Drupal/Core/Entity/EntityDisplayBase.php \Drupal\Core\Entity\EntityDisplayBase::toArray()
  2. 10 core/lib/Drupal/Core/Entity/EntityDisplayBase.php \Drupal\Core\Entity\EntityDisplayBase::toArray()
  3. 11.x core/lib/Drupal/Core/Entity/EntityDisplayBase.php \Drupal\Core\Entity\EntityDisplayBase::toArray()

Overrides ConfigEntityBase::toArray

1 call to EntityDisplayBase::toArray()
EntityDisplayBase::__sleep in core/lib/Drupal/Core/Entity/EntityDisplayBase.php

File

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

Class

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

Namespace

Drupal\Core\Entity

Code

public function toArray() {
    $properties = parent::toArray();
    // Do not store options for fields whose display is not set to be
    // configurable.
    foreach ($this->getFieldDefinitions() as $field_name => $definition) {
        if (!$definition->isDisplayConfigurable($this->displayContext)) {
            unset($properties['content'][$field_name]);
            unset($properties['hidden'][$field_name]);
        }
    }
    return $properties;
}

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