You are here

function panels_renderer_standard::add_css in Panels 6.3

Same name and namespace in other branches
  1. 7.3 plugins/display_renderers/panels_renderer_standard.class.php \panels_renderer_standard::add_css()

Add CSS information to the renderer.

To facilitate previews over Views, CSS can now be added in a manner that does not necessarily mean just using drupal_add_css. Therefore, during the panel rendering process, this method can be used to add css and make certain that ti gets to the proper location.

The arguments should exactly match drupal_add_css().

See also

drupal_add_css

1 call to panels_renderer_standard::add_css()
panels_renderer_standard::add_meta in plugins/display_renderers/panels_renderer_standard.class.php
Attach out-of-band page metadata (e.g., CSS and JS).

File

plugins/display_renderers/panels_renderer_standard.class.php, line 421

Class

panels_renderer_standard
The standard render pipeline for a Panels display object.

Code

function add_css($filename, $type = 'module', $media = 'all', $preprocess = TRUE) {
  $path = file_create_path($filename);
  switch ($this->meta_location) {
    case 'standard':
      if (file_check_location($filename, file_directory_path())) {

        // If the file is located in the files directory, use
        // ctools_css_add_css() because it can handle temporary CSS in the
        // private filesystem.
        ctools_include('css');
        ctools_css_add_css($filename, $type, $media, $preprocess);
      }
      else {
        drupal_add_css($filename, $type, $media, $preprocess);
      }
      break;
    case 'inline':
      if ($path) {
        $url = file_create_url($filename);
      }
      else {
        $url = base_path() . $filename;
      }
      $this->prefix .= '<link type="text/css" rel="stylesheet" media="' . $media . '" href="' . $url . '" />' . "\n";
      break;
  }
}