function ContentEntity::fields
Same name in other branches
- 9 core/modules/migrate_drupal/src/Plugin/migrate/source/ContentEntity.php \Drupal\migrate_drupal\Plugin\migrate\source\ContentEntity::fields()
- 8.9.x core/modules/migrate_drupal/src/Plugin/migrate/source/ContentEntity.php \Drupal\migrate_drupal\Plugin\migrate\source\ContentEntity::fields()
- 10 core/modules/migrate_drupal/src/Plugin/migrate/source/ContentEntity.php \Drupal\migrate_drupal\Plugin\migrate\source\ContentEntity::fields()
Overrides MigrateSourceInterface::fields
File
-
core/
modules/ migrate_drupal/ src/ Plugin/ migrate/ source/ ContentEntity.php, line 265
Class
- ContentEntity
- Source plugin to get content entities from the current version of Drupal.
Namespace
Drupal\migrate_drupal\Plugin\migrate\sourceCode
public function fields() {
// Retrieving fields from a non-fieldable content entity will throw a
// LogicException. Return an empty list of fields instead.
if (!$this->entityType
->entityClassImplements('Drupal\\Core\\Entity\\FieldableEntityInterface')) {
return [];
}
$field_definitions = $this->entityFieldManager
->getBaseFieldDefinitions($this->entityType
->id());
if (!empty($this->configuration['bundle'])) {
$field_definitions += $this->entityFieldManager
->getFieldDefinitions($this->entityType
->id(), $this->configuration['bundle']);
}
$fields = array_map(function ($definition) {
return (string) $definition->getLabel();
}, $field_definitions);
return $fields;
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.