function Routes::isJsonApiRequest

Same name in other branches
  1. 9 core/modules/jsonapi/src/Routing/Routes.php \Drupal\jsonapi\Routing\Routes::isJsonApiRequest()
  2. 10 core/modules/jsonapi/src/Routing/Routes.php \Drupal\jsonapi\Routing\Routes::isJsonApiRequest()
  3. 11.x 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;
}

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