You are here

function tablesorter_preprocess_table in Tablesorter 7

Implements hook_preprocess_HOOK().

Attaches the tablesorter library to tables based on the configuration form.

File

./tablesorter.module, line 323
Tablesorter.

Code

function tablesorter_preprocess_table(&$variables) {

  // Check if all tables are supposed to be sorted.
  $attach = variable_get('tablesorter_page_init_action', 'page_enable') == 'page_enable';
  if (!$attach) {

    // Check if the current path is allowed to have sorted tables.
    $paths = variable_get('tablesorter_page_list') ?: '';
    $attach = drupal_match_path(drupal_get_path_alias(), $paths) || drupal_match_path(current_path(), $paths);
  }
  if ($attach) {
    tablesorter_attach($variables);
  }
}