function ResourceObject::getField
Same name in other branches
- 9 core/modules/jsonapi/src/JsonApiResource/ResourceObject.php \Drupal\jsonapi\JsonApiResource\ResourceObject::getField()
- 8.9.x 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 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;
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.