class PagererFactory in Pagerer 8
Provides a factory for Pagerer pagers.
Hierarchy
- class \Drupal\pagerer\PagererFactory implements PagererFactoryInterface
Expanded class hierarchy of PagererFactory
3 files declare their use of PagererFactory
- PagererConfigForm.php in src/
Form/ PagererConfigForm.php - PagererPresetFormBase.php in src/
Form/ PagererPresetFormBase.php - PagererPresetPaneResetForm.php in src/
Form/ PagererPresetPaneResetForm.php
1 string reference to 'PagererFactory'
1 service uses PagererFactory
File
- src/
PagererFactory.php, line 8
Namespace
Drupal\pagererView source
class PagererFactory implements PagererFactoryInterface {
/**
* The array of pager objects.
*
* @var \Drupal\pagerer\Pagerer[]
*/
protected $pagers = [];
/**
* {@inheritdoc}
*/
public function initPagers() {
global $pager_total;
if (!empty($pager_total) && count($pager_total) > 0) {
$max_pager_id = 0;
foreach ($pager_total as $id => $value) {
$max_pager_id = $id > $max_pager_id ? $id : $max_pager_id;
}
for ($i = 0; $i <= $max_pager_id; $i++) {
$this
->get($i);
}
}
}
/**
* {@inheritdoc}
*/
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];
}
/**
* {@inheritdoc}
*/
public function all() {
return $this->pagers;
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
PagererFactory:: |
protected | property | The array of pager objects. | |
PagererFactory:: |
public | function |
Returns the array of pager objects. Overrides PagererFactoryInterface:: |
|
PagererFactory:: |
public | function |
Returns the pager object for the specified pager element. Overrides PagererFactoryInterface:: |
|
PagererFactory:: |
public | function |
Initialises the pagers. Overrides PagererFactoryInterface:: |