protected static function LabelOnlyResourceObject::extractFieldsFromEntity in Drupal 10
Same name and namespace in other branches
- 8 core/modules/jsonapi/src/JsonApiResource/LabelOnlyResourceObject.php \Drupal\jsonapi\JsonApiResource\LabelOnlyResourceObject::extractFieldsFromEntity()
- 9 core/modules/jsonapi/src/JsonApiResource/LabelOnlyResourceObject.php \Drupal\jsonapi\JsonApiResource\LabelOnlyResourceObject::extractFieldsFromEntity()
File
- core/
modules/ jsonapi/ src/ JsonApiResource/ LabelOnlyResourceObject.php, line 66
Class
- LabelOnlyResourceObject
- Value object decorating a ResourceObject; only its label is available.
Namespace
Drupal\jsonapi\JsonApiResourceCode
protected static function extractFieldsFromEntity(ResourceType $resource_type, EntityInterface $entity) {
$fields = parent::extractFieldsFromEntity($resource_type, $entity);
$public_label_field_name = $resource_type
->getPublicName(static::getLabelFieldName($entity));
return array_intersect_key($fields, [
$public_label_field_name => TRUE,
]);
}