function IncludeResolver::resolveInternalIncludePaths

Same name in other branches
  1. 9 core/modules/jsonapi/src/IncludeResolver.php \Drupal\jsonapi\IncludeResolver::resolveInternalIncludePaths()
  2. 8.9.x core/modules/jsonapi/src/IncludeResolver.php \Drupal\jsonapi\IncludeResolver::resolveInternalIncludePaths()
  3. 11.x core/modules/jsonapi/src/IncludeResolver.php \Drupal\jsonapi\IncludeResolver::resolveInternalIncludePaths()

Resolves an array of public field paths.

Parameters

\Drupal\jsonapi\ResourceType\ResourceType $base_resource_type: The base resource type from which to resolve an internal include path.

array $paths: An array of exploded include paths.

Return value

array An array of all possible internal include paths derived from the given public include paths.

See also

self::buildTree

1 call to IncludeResolver::resolveInternalIncludePaths()
IncludeResolver::toIncludeTree in core/modules/jsonapi/src/IncludeResolver.php
Returns a tree of field names to include from an include parameter.

File

core/modules/jsonapi/src/IncludeResolver.php, line 231

Class

IncludeResolver
Resolves included resources for an entity or collection of entities.

Namespace

Drupal\jsonapi

Code

protected static function resolveInternalIncludePaths(ResourceType $base_resource_type, array $paths) {
    $internal_paths = array_map(function ($exploded_path) use ($base_resource_type) {
        if (empty($exploded_path)) {
            return [];
        }
        return FieldResolver::resolveInternalIncludePath($base_resource_type, $exploded_path);
    }, $paths);
    $flattened_paths = array_reduce($internal_paths, 'array_merge', []);
    return $flattened_paths;
}

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