You are here

protected static function IncludeResolver::resolveInternalIncludePaths in Drupal 8

Same name and namespace in other branches
  1. 9 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 207

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