Commit 0fc8ab6b authored by Dries's avatar Dries

Issue #2152261 by joelpittet: Clean up for tablesort-indicator.html.twig.

parent 70d77c32
......@@ -1711,37 +1711,6 @@ function theme_table($variables) {
return $output;
}
/**
* Prepares variables for tablesort indicator templates.
*
* Default template: tablesort-indicator.html.twig.
*
* @param array $variables
* An associative array containing:
* - style: Set to either 'asc' or 'desc'. This determines which icon to show.
*/
function template_preprocess_tablesort_indicator(&$variables) {
// Provide the image attributes for an ascending or descending image.
if ($variables['style'] == 'asc') {
$variables['uri'] = 'core/misc/arrow-asc.png';
$alt_title = t('sort ascending');
}
else {
$variables['uri'] = 'core/misc/arrow-desc.png';
$alt_title = t('sort descending');
}
// Add the image element.
$variables['image'] = array(
'#theme' => 'image',
'#uri' => $variables['uri'],
'#width' => 13,
'#height' => 13,
'#alt' => $alt_title,
'#title' => $alt_title,
);
}
/**
* Returns HTML for a marker for new or updated content.
*
......
......@@ -4,15 +4,13 @@
* Default theme implementation for displaying a tablesort indicator.
*
* Available variables:
* - image: A renderable image element.
* - style: Either 'asc' or 'desc', indicating the sorting direction.
* - uri: URI to ascending or descending image.
*
* @see template_preprocess_tablesort_indicator()
*
* @ingroup themeable
*/
#}
{% spaceless %}
{{ image }}
{% endspaceless %}
{% if style == 'asc' -%}
<img src="{{ url('core/misc/arrow-asc.png') }}" width="13" height="13" alt="{{ 'sort ascending'|t }}" title="{{ 'sort ascending'|t }}" />
{% else -%}
<img src="{{ url('core/misc/arrow-desc.png') }}" width="13" height="13" alt="{{ 'sort descending'|t }}" title="{{ 'sort descending'|t }}" />
{% endif %}
Markdown is supported
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