public function EntityDisplayBase::toArray

public EntityDisplayBase::toArray()

Gets an array of all property values.

Return value

mixed[] An array of property values, keyed by property name.

Overrides ConfigEntityBase::toArray

File

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

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

© 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::toArray/8.1.x