You are here

public function ContentEntityBase::toArray in Drupal 8

Same name and namespace in other branches
  1. 9 core/lib/Drupal/Core/Entity/ContentEntityBase.php \Drupal\Core\Entity\ContentEntityBase::toArray()

Gets an array of all property values.

Return value

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

Overrides EntityBase::toArray

File

core/lib/Drupal/Core/Entity/ContentEntityBase.php, line 690

Class

ContentEntityBase
Implements Entity Field API specific enhancements to the Entity class.

Namespace

Drupal\Core\Entity

Code

public function toArray() {
  $values = [];
  foreach ($this
    ->getFields() as $name => $property) {
    $values[$name] = $property
      ->getValue();
  }
  return $values;
}