You are here

public function PagererFactory::get in Pagerer 8

Returns the pager object for the specified pager element.

Parameters

int $element: The pager element.

Return value

\Drupal\pagerer\Pagerer The pager object.

Overrides PagererFactoryInterface::get

1 call to PagererFactory::get()
PagererFactory::initPagers in src/PagererFactory.php
Initialises the pagers.

File

src/PagererFactory.php, line 36

Class

PagererFactory
Provides a factory for Pagerer pagers.

Namespace

Drupal\pagerer

Code

public function get($element) {
  if (!isset($this->pagers[$element])) {

    // Fill any gap in the sequence.
    for ($i = max(count($this->pagers) - 1, 0); $i < $element; $i++) {
      $this
        ->get($i);
    }
    $this->pagers[$element] = Pagerer::create(\Drupal::getContainer(), $element);
  }
  return $this->pagers[$element];
}