You are here

public function ContentEntityBase::toArray in Drupal 10

Same name and namespace in other branches
  1. 8 core/lib/Drupal/Core/Entity/ContentEntityBase.php \Drupal\Core\Entity\ContentEntityBase::toArray()
  2. 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 691

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