You are here

function panels_renderer_standard::add_meta in Panels 7.3

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

Attach out-of-band page metadata (e.g., CSS and JS).

This must be done before render, because panels-within-panels must have their CSS added in the right order: inner content before outer content.

2 calls to panels_renderer_standard::add_meta()
panels_renderer_editor::add_meta in plugins/display_renderers/panels_renderer_editor.class.php
Attach out-of-band page metadata (e.g., CSS and JS).
panels_renderer_standard::render in plugins/display_renderers/panels_renderer_standard.class.php
Build inner content, then hand off to layout-specified theme function for final render step.
1 method overrides panels_renderer_standard::add_meta()
panels_renderer_editor::add_meta in plugins/display_renderers/panels_renderer_editor.class.php
Attach out-of-band page metadata (e.g., CSS and JS).

File

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

Class

panels_renderer_standard

Code

function add_meta() {
  global $theme;
  if (!empty($this->plugins['layout']['css'])) {

    // Do not use the path_to_theme() function, because it returns the
    // $GLOBALS['theme_path'] value, which may be overriden in the theme()
    // function when the theme hook defines the key 'theme path'.
    $theme_path = isset($theme) ? drupal_get_path('theme', $theme) : '';
    $css = $this->plugins['layout']['css'];
    if (!is_array($css)) {
      $css = array(
        $css,
      );
    }

    // Load each of the CSS files defined in this layout.
    foreach ($css as $file) {
      if (!empty($theme_path) && file_exists($theme_path . '/' . $file)) {
        $this
          ->add_css($theme_path . '/' . $file);
      }
      else {
        $this
          ->add_css($this->plugins['layout']['path'] . '/' . $file);
      }
    }
  }
  if ($this->admin && isset($this->plugins['layout']['admin css'])) {
    $admin_css = $this->plugins['layout']['admin css'];
    if (!is_array($admin_css)) {
      $admin_css = array(
        $admin_css,
      );
    }
    foreach ($admin_css as $file) {
      $this
        ->add_css($this->plugins['layout']['path'] . '/' . $file);
    }
  }
}