You are here

function views_ui_get_admin_css in Views (for Drupal 7) 7.3

Create an array of Views admin CSS for adding or attaching.

Return value

array An array of arrays. Each array represents a single file. The array format is:

  • file: The fully qualified name of the file to send to drupal_add_css
  • options: An array of options to pass to drupal_add_css.
4 calls to views_ui_get_admin_css()
views_ui_add_admin_css in includes/admin.inc
Adds standard Views administration CSS to the current page.
views_ui_admin_settings_advanced in includes/admin.inc
Form builder for the advanced admin settings page.
views_ui_admin_settings_basic in includes/admin.inc
Form builder for the admin display defaults page.
views_ui_edit_form in includes/admin.inc
Form builder callback for editing a View.

File

includes/admin.inc, line 17
Provides the Views' administrative interface.

Code

function views_ui_get_admin_css() {
  $module_path = drupal_get_path('module', 'views_ui');
  $list = array();
  $list[$module_path . '/css/views-admin.css'] = array();
  $list[$module_path . '/css/ie/views-admin.ie7.css'] = array(
    'browsers' => array(
      'IE' => 'lte IE 7',
      '!IE' => FALSE,
    ),
    'preprocess' => FALSE,
  );
  $list[$module_path . '/css/views-admin.theme.css'] = array();

  // Add in any theme specific CSS files we have.
  $themes = list_themes();
  $theme_key = $GLOBALS['theme'];
  while ($theme_key) {

    // Try to find the admin css file for non-core themes.
    if (!in_array($theme_key, array(
      'garland',
      'seven',
      'bartik',
    ))) {
      $theme_path = drupal_get_path('theme', $theme_key);

      // First search in the css directory, then in the root folder of the
      // theme.
      if (file_exists($theme_path . "/css/views-admin.{$theme_key}.css")) {
        $list[$theme_path . "/css/views-admin.{$theme_key}.css"] = array(
          'group' => CSS_THEME,
        );
      }
      elseif (file_exists($theme_path . "/views-admin.{$theme_key}.css")) {
        $list[$theme_path . "/views-admin.{$theme_key}.css"] = array(
          'group' => CSS_THEME,
        );
      }
    }
    else {
      $list[$module_path . "/css/views-admin.{$theme_key}.css"] = array(
        'group' => CSS_THEME,
      );
    }
    $theme_key = isset($themes[$theme_key]->base_theme) ? $themes[$theme_key]->base_theme : '';
  }

  // Views contains style overrides for the following modules.
  $module_list = array(
    'contextual',
    'advanced_help',
    'ctools',
  );
  foreach ($module_list as $module) {
    if (module_exists($module)) {
      $list[$module_path . '/css/views-admin.' . $module . '.css'] = array();
    }
  }
  return $list;
}