You are here

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

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

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

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
Translates the public field name to the entity field name.
ConfigurableResourceType::getPublicName in src/ResourceType/ConfigurableResourceType.php
Translates the entity field name to the public field name.

File

src/ResourceType/ConfigurableResourceType.php, line 205

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];
}