You are here

public static function ViewUI::getAdminCSS in Views (for Drupal 7) 8.3

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

This returns 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.
5 calls to ViewUI::getAdminCSS()
ViewListController::render in views_ui/lib/Drupal/views_ui/ViewListController.php
Overrides Drupal\Core\Entity\EntityListController::render();
views_ui_admin_settings_advanced in views_ui/admin.inc
Form builder for the advanced admin settings page.
views_ui_admin_settings_basic in views_ui/admin.inc
Form builder for the admin display defaults page.
ViewUI::buildAddForm in views_ui/lib/Drupal/views_ui/ViewUI.php
ViewUI::buildEditForm in views_ui/lib/Drupal/views_ui/ViewUI.php
Form builder callback for editing a View.

File

views_ui/lib/Drupal/views_ui/ViewUI.php, line 728
Definition of Drupal\views_ui\ViewUI.

Class

ViewUI
Stores UI related temporary settings.

Namespace

Drupal\views_ui

Code

public static function getAdminCSS() {
  $module_path = drupal_get_path('module', 'views_ui');
  $list = array();
  $list[$module_path . '/css/views-admin.css'] = array();
  $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(
      '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 : '';
  }
  if (module_exists('contextual')) {
    $list[$module_path . '/css/views-admin.contextual.css'] = array();
  }
  return $list;
}