ContentEntityBase::getFields

public ContentEntityBase::getFields($include_computed = TRUE)

Gets an array of all field item lists.

Parameters

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

Return value

\Drupal\Core\Field\FieldItemListInterface[] An array of field item lists implementing, keyed by field name.

Overrides FieldableEntityInterface::getFields

File

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

Class

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

Namespace

Drupal\Core\Entity

Code

public function getFields($include_computed = TRUE) {
  $fields = array();
  foreach ($this->getFieldDefinitions() as $name => $definition) {
    if ($include_computed || !$definition->isComputed()) {
      $fields[$name] = $this->get($name);
    }
  }
  return $fields;
}
doc_Drupal
2016-10-29 08:56:55
Comments
Leave a Comment

Please login to continue.