diff --git a/core/modules/views/templates/views-mini-pager.html.twig b/core/modules/views/templates/views-mini-pager.html.twig index 5fd95dc..94427d4 100644 --- a/core/modules/views/templates/views-mini-pager.html.twig +++ b/core/modules/views/templates/views-mini-pager.html.twig @@ -12,6 +12,18 @@ */ #} {% if items %} -

{{ 'Pages'|t }}

- {{ items }} + {% endif %} diff --git a/core/modules/views/views.theme.inc b/core/modules/views/views.theme.inc index 5a06397..7132b1e 100644 --- a/core/modules/views/views.theme.inc +++ b/core/modules/views/views.theme.inc @@ -1103,6 +1103,8 @@ function template_preprocess_views_mini_pager(&$variables) { $tags += array( 1 => t('‹‹'), 3 => t('››'), + 4 => t('Previous page'), + 5 => t('Next page'), ); // Current is the page we are currently paged to. @@ -1113,9 +1115,10 @@ function template_preprocess_views_mini_pager(&$variables) { if ($pager_total[$element] > 1 && $pager_page_array[$element] > 0) { $li_previous = array( '#type' => 'link', - '#title' => $tags[1], + '#title' => '' . $tags[4] . '', '#href' => $current_path, '#options' => array( + 'html' => TRUE, 'query' => pager_query_add_page($parameters, $element, $pager_page_array[$element] - 1), 'attributes' => array( 'title' => t('Go to previous page'), @@ -1136,9 +1139,10 @@ function template_preprocess_views_mini_pager(&$variables) { if ($pager_page_array[$element] < ($pager_total[$element] - 1)) { $li_next = array( '#type' => 'link', - '#title' => $tags[3], + '#title' => '' . $tags[5] . '', '#href' => $current_path, '#options' => array( + 'html' => TRUE, 'query' => pager_query_add_page($parameters, $element, $pager_page_array[$element] + 1), 'attributes' => array( 'title' => t('Go to next page'), @@ -1162,25 +1166,11 @@ function template_preprocess_views_mini_pager(&$variables) { return; } - $items = array(); - $items[] = array( - '#wrapper_attributes' => array('class' => array('pager-previous')), - ) + $li_previous; - - $items[] = array( - '#wrapper_attributes' => array('class' => array('pager-current')), - '#markup' => t('Page @current', array('@current' => $pager_current)), - ); + $items['previous'] = $li_previous; + $items['current'] = t('Page @current', array('@current' => $pager_current)); + $items['next'] = $li_next; - $items[] = array( - '#wrapper_attributes' => array('class' => array('pager-next')), - ) + $li_next; - - $variables['items'] = array( - '#theme' => 'item_list__pager', - '#items' => $items, - '#attributes' => array('class' => array('pager')), - ); + $variables['items'] = $items; } /** diff --git a/core/modules/views_ui/src/Tests/PreviewTest.php b/core/modules/views_ui/src/Tests/PreviewTest.php index f133354..b6031d0 100644 --- a/core/modules/views_ui/src/Tests/PreviewTest.php +++ b/core/modules/views_ui/src/Tests/PreviewTest.php @@ -164,40 +164,35 @@ public function testPreviewWithPagersUI() { $this->getPreviewAJAX('test_mini_pager', 'default', 3); // Test that the pager is present and rendered. - $elements = $this->xpath('//ul[@class = "pager"]/li'); + $elements = $this->xpath('//ul[contains(@class, :class)]/li', array(':class' => 'pager__items')); $this->assertTrue(!empty($elements), 'Mini pager found.'); // Verify elements and links to pages. // We expect to find 3 elements: previous and current pages, with no link, // and next page with a link. - $this->assertClass($elements[0], 'pager-previous', 'Element for previous page has .pager-previous class.'); - $this->assertFalse(isset($elements[0]->a), 'Element for previous page has no link.'); - - $this->assertClass($elements[1], 'pager-current', 'Element for current page has .pager-current class.'); - $this->assertFalse(isset($elements[1]->a), 'Element for current page has no link.'); + $this->assertClass($elements[0], 'pager__item-current', 'Element for current page has .pager__item-current class.'); - $this->assertClass($elements[2], 'pager-next', "Element for next page has .pager-next class."); - $this->assertTrue($elements[2]->a, "Link to next page found."); + $this->assertClass($elements[1], 'pager__item-next', 'Element for next page has .pager__item-next class.'); + $this->assertTrue($elements[1]->a, 'Link to next page found.'); // Navigate to next page. - $elements = $this->xpath('//li[contains(@class, :class)]/a', array(':class' => 'pager-next')); + $elements = $this->xpath('//li[contains(@class, :class)]/a', array(':class' => 'pager__item-next')); $this->clickPreviewLinkAJAX($elements[0]['href'], 3); // Test that the pager is present and rendered. - $elements = $this->xpath('//ul[@class = "pager"]/li'); + $elements = $this->xpath('//ul[contains(@class, :class)]/li', array(':class' => 'pager__items')); $this->assertTrue(!empty($elements), 'Mini pager found.'); // Verify elements and links to pages. // We expect to find 3 elements: previous page with a link, current // page with no link, and next page with a link. - $this->assertClass($elements[0], 'pager-previous', 'Element for previous page has .pager-previous class.'); - $this->assertTrue($elements[0]->a, "Link to previous page found."); + $this->assertClass($elements[0], 'pager__item-previous', 'Element for previous page has .pager__item-previous class.'); + $this->assertTrue($elements[0]->a, 'Link to previous page found.'); - $this->assertClass($elements[1], 'pager-current', 'Element for current page has .pager-current class.'); - $this->assertFalse(isset($elements[1]->a), 'Element for current page has no link.'); + $this->assertClass($elements[1], 'pager__item-current', 'Element for current page has .pager__item-current class.'); - $this->assertClass($elements[2], 'pager-next', "Element for next page has .pager-next class."); - $this->assertTrue($elements[2]->a, "Link to next page found."); + $this->assertClass($elements[2], 'pager__item-next', 'Element for next page has .pager__item-next class.'); + $this->assertTrue($elements[2]->a, 'Link to next page found.'); } /**