You are here

public function PagerTestController::multiplePagers in Drupal 10

Same name and namespace in other branches
  1. 8 core/modules/system/tests/modules/pager_test/src/Controller/PagerTestController.php \Drupal\pager_test\Controller\PagerTestController::multiplePagers()
  2. 9 core/modules/system/tests/modules/pager_test/src/Controller/PagerTestController.php \Drupal\pager_test\Controller\PagerTestController::multiplePagers()

Returns a page with multiple pagers.

1 string reference to 'PagerTestController::multiplePagers'
pager_test.routing.yml in core/modules/system/tests/modules/pager_test/pager_test.routing.yml
core/modules/system/tests/modules/pager_test/pager_test.routing.yml

File

core/modules/system/tests/modules/pager_test/src/Controller/PagerTestController.php, line 110

Class

PagerTestController
Controller routine for testing the pager.

Namespace

Drupal\pager_test\Controller

Code

public function multiplePagers() {

  // Build three tables with same query and different pagers.
  $build['pager_table_0'] = $this
    ->buildTestTable(0, 20);
  $build['pager_pager_0'] = [
    '#type' => 'container',
    '#attributes' => [
      'class' => [
        'test-pager-0',
      ],
    ],
    'pager' => [
      '#type' => 'pager',
      '#element' => 0,
    ],
  ];
  $build['pager_table_1'] = $this
    ->buildTestTable(1, 20);
  $build['pager_pager_1'] = [
    '#type' => 'container',
    '#attributes' => [
      'class' => [
        'test-pager-1',
      ],
    ],
    'pager' => [
      '#type' => 'pager',
      '#element' => 1,
    ],
  ];
  $build['pager_table_4'] = $this
    ->buildTestTable(4, 20);
  $build['pager_pager_4'] = [
    '#type' => 'container',
    '#attributes' => [
      'class' => [
        'test-pager-4',
      ],
    ],
    'pager' => [
      '#type' => 'pager',
      '#element' => 4,
    ],
  ];
  return $build;
}