Skip to main content
Drupal API
User account menu
  • Log in

Breadcrumb

  1. Drupal Core 11.1.x
  2. ResourceObject.php

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\JsonApiResource

Code

public function getField($public_field_name) {
    return $this->hasField($public_field_name) ? $this->fields[$public_field_name] : NULL;
}

API Navigation

  • Drupal Core 11.1.x
  • Topics
  • Classes
  • Functions
  • Constants
  • Globals
  • Files
  • Namespaces
  • Deprecated
  • Services
RSS feed
Powered by Drupal