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

Breadcrumb

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

function FieldResolver::constructInternalPath

Expands the internal path with the "entity" keyword.

Parameters

string[] $references: The resolved internal field names of all entity references.

string[] $property_path: (optional) A sub-property path for the last field in the path.

Return value

string The expanded and imploded path.

1 call to FieldResolver::constructInternalPath()
FieldResolver::resolveInternalEntityQueryPath in core/modules/jsonapi/src/Context/FieldResolver.php
Resolves external field expressions into entity query compatible paths.

File

core/modules/jsonapi/src/Context/FieldResolver.php, line 459

Class

FieldResolver
A service that evaluates external path expressions against Drupal fields.

Namespace

Drupal\jsonapi\Context

Code

protected function constructInternalPath(array $references, array $property_path = []) {
    // Reconstruct the path parts that are referencing sub-properties.
    $field_path = implode('.', array_map(function ($part) {
        return str_replace('drupal_internal__', '', $part);
    }, $property_path));
    // This rebuilds the path from the real, internal field names that have
    // been traversed so far. It joins them with the "entity" keyword as
    // required by the entity query system.
    $entity_path = implode('.', $references);
    // Reconstruct the full path to the final reference field.
    return empty($field_path) ? $entity_path : $entity_path . '.' . $field_path;
}

API Navigation

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