public function ContentEntityBase::getTranslatableFields in Drupal 9
Same name and namespace in other branches
- 8 core/lib/Drupal/Core/Entity/ContentEntityBase.php \Drupal\Core\Entity\ContentEntityBase::getTranslatableFields()
- 10 core/lib/Drupal/Core/Entity/ContentEntityBase.php \Drupal\Core\Entity\ContentEntityBase::getTranslatableFields()
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
- core/
lib/ Drupal/ Core/ Entity/ ContentEntityBase.php, line 648
Class
- ContentEntityBase
- Implements Entity Field API specific enhancements to the Entity class.
Namespace
Drupal\Core\EntityCode
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;
}