You are here

public static function Routes::isJsonApiRequest in Drupal 10

Same name and namespace in other branches
  1. 8 core/modules/jsonapi/src/Routing/Routes.php \Drupal\jsonapi\Routing\Routes::isJsonApiRequest()
  2. 9 core/modules/jsonapi/src/Routing/Routes.php \Drupal\jsonapi\Routing\Routes::isJsonApiRequest()

Determines if the given request is for a JSON:API generated route.

Parameters

array $defaults: The request's route defaults.

Return value

bool Whether the request targets a generated route.

2 calls to Routes::isJsonApiRequest()
ResourceVersionRouteEnhancer::enhance in core/modules/jsonapi/src/Revisions/ResourceVersionRouteEnhancer.php
RouteEnhancer::enhance in core/modules/jsonapi/src/Routing/RouteEnhancer.php

File

core/modules/jsonapi/src/Routing/Routes.php, line 266

Class

Routes
Defines dynamic routes.

Namespace

Drupal\jsonapi\Routing

Code

public static function isJsonApiRequest(array $defaults) {
  return isset($defaults[RouteObjectInterface::CONTROLLER_NAME]) && strpos($defaults[RouteObjectInterface::CONTROLLER_NAME], static::CONTROLLER_SERVICE_NAME) === 0;
}