Commit 88b192cd authored by alexpott's avatar alexpott
Browse files

Issue #1912604 by joelpittet, mondrake, damiankloip, gollyg, Cottser: Convert...

Issue #1912604 by joelpittet, mondrake, damiankloip, gollyg, Cottser: Convert theme_views_mini_pager() to twig.
parent 0e47ce32
{#
/**
* @file
* Default theme implementation for a views mini-pager.
*
* Available variables:
* - items: List of pager items.
*
* @see template_preprocess_views_mini_pager()
*
* @ingroup themeable
*/
#}
{% if items %}
{{ items }}
{% endif %}
...@@ -94,6 +94,7 @@ function views_theme($existing, $type, $theme, $path) { ...@@ -94,6 +94,7 @@ function views_theme($existing, $type, $theme, $path) {
// Our extra version of pager from pager.inc // Our extra version of pager from pager.inc
$hooks['views_mini_pager'] = $base + array( $hooks['views_mini_pager'] = $base + array(
'variables' => array('tags' => array(), 'quantity' => 10, 'element' => 0, 'parameters' => array()), 'variables' => array('tags' => array(), 'quantity' => 10, 'element' => 0, 'parameters' => array()),
'template' => 'views-mini-pager',
); );
$variables = array( $variables = array(
......
...@@ -1063,9 +1063,18 @@ function template_preprocess_views_exposed_form(&$variables) { ...@@ -1063,9 +1063,18 @@ function template_preprocess_views_exposed_form(&$variables) {
} }
/** /**
* Theme function for the Mini pager. * Prepares variables for views mini-pager templates.
*
* Default template: views-mini-pager.html.twig.
*
* @param array $variables
* An associative array containing:
* - tags: Provides link text for the next/previous links.
* - element: The pager's id.
* - parameters: Any extra GET parameters that should be retained, such as
* exposed input.
*/ */
function theme_views_mini_pager($variables) { function template_preprocess_views_mini_pager(&$variables) {
global $pager_page_array, $pager_total; global $pager_page_array, $pager_total;
$tags = &$variables['tags']; $tags = &$variables['tags'];
...@@ -1132,9 +1141,10 @@ function theme_views_mini_pager($variables) { ...@@ -1132,9 +1141,10 @@ function theme_views_mini_pager($variables) {
// link, which means that we are on the first page and there is no next page // link, which means that we are on the first page and there is no next page
// available/wanted. // available/wanted.
if (empty($li_next) && empty($li_previous)) { if (empty($li_next) && empty($li_previous)) {
return ''; return;
} }
$items = array();
$items[] = array( $items[] = array(
'#wrapper_attributes' => array('class' => array('pager-previous')), '#wrapper_attributes' => array('class' => array('pager-previous')),
) + $li_previous; ) + $li_previous;
...@@ -1148,16 +1158,11 @@ function theme_views_mini_pager($variables) { ...@@ -1148,16 +1158,11 @@ function theme_views_mini_pager($variables) {
'#wrapper_attributes' => array('class' => array('pager-next')), '#wrapper_attributes' => array('class' => array('pager-next')),
) + $li_next; ) + $li_next;
$item_list = array( $variables['items'] = array(
'#theme' => 'item_list__pager', '#theme' => 'item_list__pager',
'#items' => $items, '#items' => $items,
'#title' => NULL, '#attributes' => array('class' => array('pager')),
'#list_type' => 'ul',
'#attributes' => array(
'class' => array('pager'),
),
); );
return drupal_render($item_list);
} }
/** /**
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment