function ResourceObject::hasField

Same name in other branches
  1. 9 core/modules/jsonapi/src/JsonApiResource/ResourceObject.php \Drupal\jsonapi\JsonApiResource\ResourceObject::hasField()
  2. 8.9.x core/modules/jsonapi/src/JsonApiResource/ResourceObject.php \Drupal\jsonapi\JsonApiResource\ResourceObject::hasField()
  3. 11.x core/modules/jsonapi/src/JsonApiResource/ResourceObject.php \Drupal\jsonapi\JsonApiResource\ResourceObject::hasField()

Whether the resource object has the given field.

Parameters

string $public_field_name: A public field name.

Return value

bool TRUE if the resource object has the given field, FALSE otherwise.

1 call to ResourceObject::hasField()
ResourceObject::getField in core/modules/jsonapi/src/JsonApiResource/ResourceObject.php
Gets the given field.

File

core/modules/jsonapi/src/JsonApiResource/ResourceObject.php, line 141

Class

ResourceObject
Represents a JSON:API resource object.

Namespace

Drupal\jsonapi\JsonApiResource

Code

public function hasField($public_field_name) {
    return isset($this->fields[$public_field_name]);
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.