function 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 156
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;
}