function ResourceType::getFieldByPublicName

Same name and namespace in other branches
  1. 8.9.x core/modules/jsonapi/src/ResourceType/ResourceType.php \Drupal\jsonapi\ResourceType\ResourceType::getFieldByPublicName()
  2. 10 core/modules/jsonapi/src/ResourceType/ResourceType.php \Drupal\jsonapi\ResourceType\ResourceType::getFieldByPublicName()
  3. 11.x core/modules/jsonapi/src/ResourceType/ResourceType.php \Drupal\jsonapi\ResourceType\ResourceType::getFieldByPublicName()

Gets a particular attribute or relationship field by public field name.

Parameters

string $public_field_name: The public field name of the desired field.

Return value

\Drupal\jsonapi\ResourceType\ResourceTypeField|null A resource type field object or NULL if the field does not exist on this resource type.

1 call to ResourceType::getFieldByPublicName()
ResourceType::getRelatableResourceTypesByField in core/modules/jsonapi/src/ResourceType/ResourceType.php
Get all resource types with which the given field may have a relationship.

File

core/modules/jsonapi/src/ResourceType/ResourceType.php, line 200

Class

ResourceType
Value object containing all metadata for a JSON:API resource type.

Namespace

Drupal\jsonapi\ResourceType

Code

public function getFieldByPublicName($public_field_name) {
    return isset($this->fieldMapping[$public_field_name]) ? $this->getFieldByInternalName($this->fieldMapping[$public_field_name]) : NULL;
}

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