public function EntityResource::getIncludes in Drupal 10
Same name and namespace in other branches
- 8 core/modules/jsonapi/src/Controller/EntityResource.php \Drupal\jsonapi\Controller\EntityResource::getIncludes()
- 9 core/modules/jsonapi/src/Controller/EntityResource.php \Drupal\jsonapi\Controller\EntityResource::getIncludes()
Gets includes for the given response data.
Parameters
\Symfony\Component\HttpFoundation\Request $request: The request object.
\Drupal\jsonapi\JsonApiResource\ResourceObject|\Drupal\jsonapi\JsonApiResource\ResourceObjectData $data: The response data from which to resolve includes.
Return value
\Drupal\jsonapi\JsonApiResource\Data A Data object to be included or a NullData object if the request does not specify any include paths.
Throws
\Drupal\Component\Plugin\Exception\InvalidPluginDefinitionException
\Drupal\Component\Plugin\Exception\PluginNotFoundException
File
- core/
modules/ jsonapi/ src/ Controller/ EntityResource.php, line 1127
Class
- EntityResource
- Process all entity requests.
Namespace
Drupal\jsonapi\ControllerCode
public function getIncludes(Request $request, $data) {
assert($data instanceof ResourceObject || $data instanceof ResourceObjectData);
return $request->query
->has('include') && ($include_parameter = $request->query
->get('include')) && !empty($include_parameter) ? $this->includeResolver
->resolve($data, $include_parameter) : new NullIncludedData();
}