You are here

public function FieldableEdgeEntityBase::getTranslatableFields in Apigee Edge 8

Gets an array of field item lists for translatable fields.

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::getTranslatableFields

File

src/Entity/FieldableEdgeEntityBase.php, line 342

Class

FieldableEdgeEntityBase
Base field support for Apigee Entities without making them content entities.

Namespace

Drupal\apigee_edge\Entity

Code

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