You are here

function panels_renderer_legacy::add_css in Panels 6.3

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

File

plugins/display_renderers/panels_renderer_legacy.class.php, line 63

Class

panels_renderer_legacy
Legacy render pipeline for a panels display.

Code

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

        // Use CTools CSS add because it can handle temporary CSS in 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;
  }
}