You are here

private function ConfigurableResourceType::translateFieldName in JSON:API Extras 8.2

Same name and namespace in other branches
  1. 8 src/ResourceType/ConfigurableResourceType.php \Drupal\jsonapi_extras\ResourceType\ConfigurableResourceType::translateFieldName()

Given the internal or public field name, get the other one.

@todo Remove this when JSON API Extras drops support for JSON API 1.x.

Parameters

string $field_name: The name of the field.

string $from: The realm of the provided field name.

string $to: The realm of the desired field name.

Return value

string The field name in the desired realm.

2 calls to ConfigurableResourceType::translateFieldName()
ConfigurableResourceType::getInternalName in src/ResourceType/ConfigurableResourceType.php
@todo Remove this when JSON API Extras drops support for JSON API 1.x.
ConfigurableResourceType::getPublicName in src/ResourceType/ConfigurableResourceType.php
@todo Remove this when JSON API Extras drops support for JSON API 1.x.

File

src/ResourceType/ConfigurableResourceType.php, line 241

Class

ConfigurableResourceType
Defines a configurable resource type.

Namespace

Drupal\jsonapi_extras\ResourceType

Code

private function translateFieldName($field_name, $from, $to) {
  $resource_field = $this
    ->getResourceFieldConfiguration($field_name, $from);
  return empty($resource_field[$to]) ? $field_name : $resource_field[$to];
}