diff -u b/core/includes/theme.inc b/core/includes/theme.inc --- b/core/includes/theme.inc +++ b/core/includes/theme.inc @@ -1828,7 +1828,7 @@ $items['pages'][$i]['attributes'] = new Attribute(); if ($i == $pager_current) { $variables['current'] = $i; - $items['pages'][$i]['attributes']['aria-current'] = t('Current page'); + $items['pages'][$i]['attributes']->setAttribute('aria-current', t('Current page')); } } // Add an ellipsis if there are further next pages. diff -u b/core/modules/system/tests/src/Unit/Pager/PreprocessPagerTest.php b/core/modules/system/tests/src/Unit/Pager/PreprocessPagerTest.php --- b/core/modules/system/tests/src/Unit/Pager/PreprocessPagerTest.php +++ b/core/modules/system/tests/src/Unit/Pager/PreprocessPagerTest.php @@ -52,6 +52,27 @@ require_once $this->root . '/core/includes/theme.inc'; $variables = [ 'pager' => [ + '#element' => '', + '#parameters' => [], + '#quantity' => '', + '#route_name' => '', + '#tags' => '', + ], + ]; + template_preprocess_pager($variables); + + $this->assertEquals(['first', 'previous'], array_keys($variables['items'])); + } + + /** + * Tests template_preprocess_pager() when a #quantity value is passed. + * + * @covers ::template_preprocess_pager + */ + public function testQuantitySet() { + require_once $this->root . '/core/includes/theme.inc'; + $variables = [ + 'pager' => [ '#element' => '2', '#parameters' => [], '#quantity' => '2',