You are here

function responsive_tables_add_css in Responsive Tables 7.2

Add the CSS necessary for responsive tables to actually work.

2 calls to responsive_tables_add_css()
responsive_tables_preprocess_views_view_table in ./responsive_tables.module
responsive_tables_theme_table in ./responsive_tables.module
Overrides theme_table() with responsive support.

File

./responsive_tables.module, line 377

Code

function responsive_tables_add_css() {
  $theme = $GLOBALS['theme'];
  $medium = theme_get_setting('responsive_tables_medium_priority_max_width');
  $low = theme_get_setting('responsive_tables_low_priority_max_width');
  if (!empty($medium) && !empty($low)) {
    $css = <<<CSS
@media (max-width:{<span class="php-variable">$low</span>}) {
  th.priority-low, td.priority-low, th.priority-medium, td.priority-medium {
    display: none;
  }
}
@media (max-width:{<span class="php-variable">$medium</span>}) {
  th.priority-low, td.priority-low {
    display: none;
  }
}
CSS;
    drupal_add_css($css, array(
      'type' => 'inline',
      'media' => 'screen',
    ));
  }
  else {
    $css_file = $css = drupal_get_path('module', 'responsive_tables') . '/css/' . $GLOBALS['theme'] . '.css';
    if (is_file($css)) {
      drupal_add_css($css);
    }
  }
}