Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
By dawehner on
Change record status:
Published (View all published change records)
Project:
Introduced in branch:
8.x
Issue links:
Description:
Drupal 7
If you wanted to allow people to enable click sorting on a table view for certain fields you had to add the flag in your views data:
/**
* Implements hook_views_data().
*/
function example_views_data() {
$data['example']['example_field']['field'] = array(
'click sortable' => TRUE,
);
return $data;
}
Drupal 8
Now in Drupal 8 you have click sortable enabled by default, though you can disable it via:
/**
* Implements hook_views_data().
*/
function example_views_data() {
$data['example']['example_field']['field'] = array(
'click sortable' => FALSE,
);
return $data;
}
One use case for that is, when your actual rendered data is constructed on the fly, so sorting can't be done on the sql level.
Impacts:
Module developers