[ Index ]

PHP Cross Reference of Drupal 6 (gatewave)

title

Body

[close]

/sites/all/modules/panels/includes/ -> display-render.inc (source)

   1  <?php
   2  // $Id: display-render.inc,v 1.5.2.29 2010/07/26 21:24:22 merlinofchaos Exp $
   3  
   4  /**
   5   * @file
   6   *
   7   * Contains Panels display rendering functions.
   8   */
   9  
  10  /**
  11   * Render the administrative layout of a display.
  12   *
  13   * This is used for the edit version, so that layouts can have different
  14   * modes, such as the flexible layout designer mode.
  15   */
  16  function panels_render_layout_admin($layout, $content, $display) {
  17    // @todo This should be abstracted.
  18    if (!empty($layout['css'])) {
  19      if (file_exists(path_to_theme() . '/' . $layout['css'])) {
  20        drupal_add_css(path_to_theme() . '/' . $layout['css']);
  21      }
  22      else {
  23        drupal_add_css($layout['path'] . '/' . $layout['css']);
  24      }
  25    }
  26  
  27    if (isset($layout['admin css'])) {
  28      drupal_add_css($layout['path'] . '/' . $layout['admin css']);
  29    }
  30  
  31    $theme = isset($layout['admin theme']) ? $layout['admin theme'] : $layout['theme'];
  32    return theme($theme, isset($display->css_id) ? $display->css_id : '', $content, $display->layout_settings, $display, $layout);
  33  }
  34  
  35  /**
  36   * Render a pane using the appropriate style.
  37   *
  38   * Legacy function; this behavior has been moved onto the display renderer
  39   * object. The function name here is included for backwards compatibility. New
  40   * style plugins should NEVER call it.
  41   *
  42   * $content
  43   *   The already rendered content via panels_render_pane_content()
  44   * $pane
  45   *   The $pane information from the display
  46   * $display
  47   *   The display.
  48   */
  49  function panels_render_pane($content, $pane, &$display) {
  50    if ($display->hide_title == PANELS_TITLE_PANE && !empty($display->title_pane) && $display->title_pane == $pane->pid) {
  51  
  52      // If the user selected to override the title with nothing, and selected
  53      // this as the title pane, assume the user actually wanted the original
  54      // title to bubble up to the top but not actually be used on the pane.
  55      if (empty($content->title) && !empty($content->original_title)) {
  56        $display->stored_pane_title = $content->original_title;
  57      }
  58      else {
  59        $display->stored_pane_title = !empty($content->title) ? $content->title : '';
  60      }
  61    }
  62  
  63    if (!empty($content->content)) {
  64      if (!empty($pane->style['style'])) {
  65        $style = panels_get_style($pane->style['style']);
  66  
  67        if (isset($style) && isset($style['render pane'])) {
  68          $output = theme($style['render pane'], $content, $pane, $display, $style);
  69  
  70          // This could be null if no theme function existed.
  71          if (isset($output)) {
  72            return $output;
  73          }
  74        }
  75      }
  76  
  77      // fallback
  78      return theme('panels_pane', $content, $pane, $display);
  79    }
  80  }
  81  
  82  /**
  83   * Given a display and the id of a panel, get the style in which to render
  84   * that panel.
  85   */
  86  function panels_get_panel_style_and_settings($panel_settings, $panel) {
  87    if (empty($panel_settings)) {
  88      return array(panels_get_style('default'), array());
  89    }
  90  
  91    if (empty($panel_settings[$panel]['style']) || $panel_settings[$panel]['style'] == -1) {
  92      if (empty($panel_settings['style'])) {
  93        return array(panels_get_style('default'), array());
  94      }
  95  
  96      $style = panels_get_style($panel_settings['style']);
  97      $style_settings = isset($panel_settings['style_settings']['default']) ? $panel_settings['style_settings']['default'] : array();
  98    }
  99    else {
 100      $style = panels_get_style($panel_settings[$panel]['style']);
 101      $style_settings = isset($panel_settings['style_settings'][$panel]) ? $panel_settings['style_settings'][$panel] : array();
 102    }
 103  
 104    return array($style, $style_settings);
 105  }


Generated: Thu Mar 24 11:18:33 2011 Cross-referenced by PHPXref 0.7