You are here

public function EntityAdapter::getProperties in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 core/lib/Drupal/Core/Entity/Plugin/DataType/EntityAdapter.php \Drupal\Core\Entity\Plugin\DataType\EntityAdapter::getProperties()

Gets an array of property objects.

Parameters

bool $include_computed: If set to TRUE, computed properties are included. Defaults to FALSE.

Return value

\Drupal\Core\TypedData\TypedDataInterface[] An array of property objects implementing the TypedDataInterface, keyed by property name.

Throws

\Drupal\Core\TypedData\Exception\MissingDataException If the complex data structure is unset and no property can be created.

Overrides ComplexDataInterface::getProperties

1 call to EntityAdapter::getProperties()
EntityAdapter::applyDefaultValue in core/lib/Drupal/Core/Entity/Plugin/DataType/EntityAdapter.php
Applies the default value.

File

core/lib/Drupal/Core/Entity/Plugin/DataType/EntityAdapter.php, line 114
Contains \Drupal\Core\Entity\Plugin\DataType\EntityAdapter.

Class

EntityAdapter
Defines the "entity" data type.

Namespace

Drupal\Core\Entity\Plugin\DataType

Code

public function getProperties($include_computed = FALSE) {
  if (!isset($this->entity)) {
    throw new MissingDataException('Unable to get properties as no entity has been provided.');
  }
  if (!$this->entity instanceof FieldableEntityInterface) {

    // @todo: Add support for config entities in
    // https://www.drupal.org/node/1818574.
    return array();
  }
  return $this->entity
    ->getFields($include_computed);
}