function views_ui::tablesort_link

3.x views_ui.class.php views_ui::tablesort_link($label, $field, $class)
1 call to views_ui::tablesort_link()

File

plugins/export_ui/views_ui.class.php, line 285
Contains the CTools Export UI integration code.

Class

views_ui
CTools Export UI class handler for Views UI.

Code

function tablesort_link($label, $field, $class) {
  $title = t('sort by @s', array('@s' => $label));
  $initial = 'asc';

  if ($this->active == $field) {
    $initial = ($this->order == 'asc') ? 'desc' : 'asc';
    $label .= theme('tablesort_indicator', array('style' => $initial));
  }

  $query['order'] = $field;
  $query['sort'] = $initial;
  $link_options = array(
    'html' => TRUE,
    'attributes' => array('title' => $title),
    'query' => $query,
  );
  $link = l($label, $_GET['q'], $link_options);
  if ($this->active == $field) {
    $class .= ' active';
  }

  return array('data' => $link, 'class' => $class);
}