You are here

protected function EntityResource::determinePageLimit in JSON:API Extras 8.3

Get amount of items displayed per page considering the request query.

Fall back to the JSON:API standard value of 50 if not customized.

Parameters

array $page_params: The values of the page query parameter of the request.

Drupal\jsonapi_extras\Entity\JsonapiResourceConfig $resource_config: This resource's config entity.

Return value

int Max number of items.

1 call to EntityResource::determinePageLimit()
EntityResource::setPageLimit in modules/jsonapi_defaults/src/Controller/EntityResource.php
Sets a jsonapi parameter for the page limit if applicable.

File

modules/jsonapi_defaults/src/Controller/EntityResource.php, line 209

Class

EntityResource
Overrides jsonapi module EntityResource controller.

Namespace

Drupal\jsonapi_defaults\Controller

Code

protected function determinePageLimit(array $page_params, JsonapiResourceConfig $resource_config) {
  $query_limit = !empty($page_params['limit']) ? (int) $page_params['limit'] : OffsetPage::SIZE_MAX;
  $page_limit = $resource_config
    ->getThirdPartySetting('jsonapi_defaults', 'page_limit') ?: OffsetPage::SIZE_MAX;
  return min($query_limit, (int) $page_limit);
}