protected function getAllFieldNames(EntityTypeInterface
$entity_type,
$bundle) { if ($entity_type instanceof ContentEntityTypeInterface
) { $field_definitions =
$this->entityFieldManager->
getFieldDefinitions( $entity_type->
id(),
$bundle );
return array_keys($field_definitions);
} elseif ($entity_type instanceof ConfigEntityTypeInterface
) { // @todo Uncomment the first line, remove everything else once https://www.drupal.org/project/drupal/issues/2483407 lands.
// return array_keys($entity_type->getPropertiesToExport());
$export_properties =
$entity_type->
getPropertiesToExport();
if ($export_properties !== NULL
) { return array_keys($export_properties);
} else { return ['id', 'type', 'uuid', '_core'
];
} } else { throw new \
LogicException("Only content and config entity types are supported."
);
} }