You are here

function _responsive_tables_filter_add_js_css in Responsive Tables Filter 7

Add Tablesaw JS and CSS.

4 calls to _responsive_tables_filter_add_js_css()
responsive_tables_filter_init in ./responsive_tables_filter.module
Implements hook_init().
responsive_tables_filter_preprocess_page in ./responsive_tables_filter.module
Implements hook_preprocess_page().
responsive_tables_filter_preprocess_views_view_table in ./responsive_tables_filter.module
Implements hook_preprocess_views_view_table().
theme_file_formatter_responsive_table in ./responsive_tables_filter.module
Returns HTML for a file attachments table.

File

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

Code

function _responsive_tables_filter_add_js_css() {
  $every_page = variable_get(RESPONSIVE_TABLES_FILTER_EVERY_PAGE, FALSE);
  $module_path = drupal_get_path('module', 'responsive_tables_filter');

  // Check if the user has supplied custom CSS. If not, use default.
  $custom = variable_get(RESPONSIVE_TABLES_FILTER_CUSTOM_CSS, '');
  if (!empty($custom)) {
    drupal_add_css($custom, array(
      'every_page' => $every_page,
    ));
  }
  else {
    drupal_add_css($module_path . '/tablesaw/css/tablesaw.stackonly-base.css', [
      'every_page' => $every_page,
      'weight' => 31,
    ]);
    drupal_add_css($module_path . '/tablesaw/css/tablesaw.stackonly-responsive.css', [
      'every_page' => $every_page,
      'media' => 'screen',
      'weight' => 32,
    ]);
  }
  drupal_add_js($module_path . '/tablesaw/js/tablesaw.stackonly.jquery.js', array(
    'every_page' => $every_page,
    'scope' => 'footer',
    'weight' => 30,
  ));
  drupal_add_js($module_path . '/tablesaw/js/tablesaw-init.js', array(
    'every_page' => $every_page,
    'scope' => 'footer',
    'weight' => 31,
  ));
}