template_preprocess_tablesort_indicator()
was removed and its logic was moved to tablesort-indicator.html.twig
.
Drupal 7
Copy the theme function theme_tablesort_indicator()
from includes/theme.inc
to your custom theme's settings.php file and provide a path to your theme's folder.
// MY_THEME/settings.php
function MY_THEME_tablesort_indicator($variables) {
// Get the path to my theme.
$path = drupal_get_path('theme', 'MY_THEME');
if ($variables['style'] == "asc") {
return theme('image', array('path' => $path . '/icons/arrow-asc.png', 'width' => 13, 'height' => 13, 'alt' => t('sort ascending'), 'title' => t('sort ascending')));
}
else {
return theme('image', array('path' => $path . '/icons/arrow-desc.png', 'width' => 13, 'height' => 13, 'alt' => t('sort descending'), 'title' => t('sort descending')));
}
}
Drupal 8
Override the following lines to your theme's CSS file and add your new images if need be(could be now done without images)
.tablesort--asc {
background-image: url(../icons/twistie-down.svg);
}
.tablesort--desc {
background-image: url(../icons/twistie-up.svg);
}
Also:
SVG Icons have now replaced the existing PNG images used for up and down arrows in the sort order UIs. This helps immensely when viewing on high-resolution displays and mobile devices, since SVGs are resolution-independent.