You are here

function responsive_tables_filter_preprocess_views_view_table in Responsive Tables Filter 7

Same name and namespace in other branches
  1. 8 responsive_tables_filter.module \responsive_tables_filter_preprocess_views_view_table()

Implements hook_preprocess_views_view_table().

Adds tablesaw JS when tables present and CSS/JS aggregation is off to table.

File

./responsive_tables_filter.module, line 281
Make tables responsive, when filter is enabled for the field.

Code

function responsive_tables_filter_preprocess_views_view_table(&$variables) {

  // Only execute if this View is using the default theme.
  if ((_responsive_tables_filter_is_theme_default() || variable_get(RESPONSIVE_TABLES_FILTER_ADMIN, TRUE)) && variable_get(RESPONSIVE_TABLES_FILTER_VIEWS, TRUE)) {

    // Add tablesaw classes & attribute.
    $variables['classes_array'][] = 'tablesaw';
    $variables['classes_array'][] = 'tablesaw-stack';
    $variables['attributes_array']['data-tablesaw-mode'] = 'stack';

    // If we aren't loading assets on every page, do so here.
    if (!variable_get(RESPONSIVE_TABLES_FILTER_EVERY_PAGE, FALSE)) {
      _responsive_tables_filter_add_js_css();
    }
  }
}