function responsive_tables_filter_preprocess_table in Responsive Tables Filter 8
Implements hook_preprocess_table().
Adds Tablesaw to all Drupal tables generated using the 'table' render.
File
- ./
responsive_tables_filter.module, line 81 - Contains responsive_tables_filter.module..
Code
function responsive_tables_filter_preprocess_table(&$variables) {
$config = \Drupal::config('responsive_tables_filter.settings');
if ($config
->get('views_enabled')) {
$mode = $config
->get('views_tablesaw_mode');
// Add tablesaw classes & data attribute.
$variables['attributes']['class'][] = 'tablesaw';
$variables['attributes']['class'][] = 'tablesaw-' . $mode;
$variables['attributes']['data-tablesaw-mode'][] = $mode;
$variables['#attached']['library'][] = 'responsive_tables_filter/tablesaw-filter';
$variables['#cache']['tags'][] = 'config:responsive_tables_filter.settings';
}
}