public function ResourceObject::getField in Drupal 8
Same name and namespace in other branches
- 9 core/modules/jsonapi/src/JsonApiResource/ResourceObject.php \Drupal\jsonapi\JsonApiResource\ResourceObject::getField()
- 10 core/modules/jsonapi/src/JsonApiResource/ResourceObject.php \Drupal\jsonapi\JsonApiResource\ResourceObject::getField()
Gets the given field.
Parameters
string $public_field_name: A public field name.
Return value
mixed|\Drupal\Core\Field\FieldItemListInterface|null The field or NULL if the resource object does not have the given field.
See also
::extractFields()
File
- core/
modules/ jsonapi/ src/ JsonApiResource/ ResourceObject.php, line 140
Class
- ResourceObject
- Represents a JSON:API resource object.
Namespace
Drupal\jsonapi\JsonApiResourceCode
public function getField($public_field_name) {
return $this
->hasField($public_field_name) ? $this->fields[$public_field_name] : NULL;
}