function ContentEntityBase::getFields

Same name and namespace in other branches
  1. 9 core/lib/Drupal/Core/Entity/ContentEntityBase.php \Drupal\Core\Entity\ContentEntityBase::getFields()
  2. 8.9.x core/lib/Drupal/Core/Entity/ContentEntityBase.php \Drupal\Core\Entity\ContentEntityBase::getFields()
  3. 10 core/lib/Drupal/Core/Entity/ContentEntityBase.php \Drupal\Core\Entity\ContentEntityBase::getFields()
3 calls to ContentEntityBase::getFields()
ContentEntityBase::getIterator in core/lib/Drupal/Core/Entity/ContentEntityBase.php
ContentEntityBase::referencedEntities in core/lib/Drupal/Core/Entity/ContentEntityBase.php
Gets a list of entities referenced by this entity.
ContentEntityBase::toArray in core/lib/Drupal/Core/Entity/ContentEntityBase.php
Gets an array of all property values.

File

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

Class

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

Namespace

Drupal\Core\Entity

Code

public function getFields($include_computed = TRUE) {
    $fields = [];
    foreach ($this->getFieldDefinitions() as $name => $definition) {
        if ($include_computed || !$definition->isComputed()) {
            $fields[$name] = $this->get($name);
        }
    }
    return $fields;
}

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