You are here

public function PagerManager::reservePagerElementId in Drupal 9

Reserve a pager element ID.

Calling code may need to reserve the ID of a pager before actually creating it. This methods allows to do so ensuring no collision occurs with ::getMaxPagerElementId().

Parameters

int $element: The ID of the pager to be reserved.

Overrides PagerManagerInterface::reservePagerElementId

See also

\Drupal\Core\Database\Query\PagerSelectExtender::element()

File

core/lib/Drupal/Core/Pager/PagerManager.php, line 110

Class

PagerManager
Provides a manager for pagers.

Namespace

Drupal\Core\Pager

Code

public function reservePagerElementId(int $element) : void {
  $this->maxPagerElementId = max($element, $this->maxPagerElementId);

  // BC for PagerSelectExtender::$maxElement.
  // @todo remove the line below in D10.
  PagerSelectExtender::$maxElement = $this
    ->getMaxPagerElementId();
}