You are here

class panels_display in Panels 8.3

Same name and namespace in other branches
  1. 5.2 panels.module \panels_display
  2. 6.3 panels.module \panels_display
  3. 6.2 panels.module \panels_display
  4. 7.3 panels.module \panels_display

Forms the basis of a panel display

Hierarchy

Expanded class hierarchy of panels_display

Related topics

4 string references to 'panels_display'
panels_export_display in ./panels.module
Exports the provided display into portable code.
panels_load_displays in ./panels.module
Load and fill the requested $display object(s).
panels_new_display in ./panels.module
Creates a new display, setting the ID to our magic new id.
panels_save_display in ./panels.module
Save a display object.

File

./panels.module, line 394
panels.module

View source
class panels_display {
  var $args = array();
  var $content = array();
  var $panels = array();
  var $incoming_content = NULL;
  var $css_id = NULL;
  var $context = array();
  var $did = 'new';
  var $renderer = 'standard';
  function add_pane(&$pane, $location = NULL) {

    // If no location specified, use what's set in the pane.
    if (empty($location)) {
      $location = $pane->panel;
    }
    else {
      $pane->panel = $location;
    }

    // Generate a permanent uuid for this pane, and use
    // it as a temporary pid.
    $pane->uuid = ctools_uuid_generate();
    $pane->pid = 'new-' . $pane->uuid;

    // Add the pane to the approprate spots.
    $this->content[$pane->pid] =& $pane;
    $this->panels[$location][] = $pane->pid;
  }
  function duplicate_pane($pid, $location = FALSE) {
    $pane = $this
      ->clone_pane($pid);
    $this
      ->add_pane($pane, $location);
  }
  function clone_pane($pid) {
    $pane = clone $this->content[$pid];
    $pane->uuid = ctools_uuid_generate();
    return $pane;
  }

  /**
   * Get the title from a display.
   *
   * The display must have already been rendered, or the setting to set the
   * display's title from a pane's title will not have worked.
   *
   * @return
   *   The title to use. If NULL, this means to let any default title that may be in use
   *   pass through. i.e, do not actually set the title.
   */
  function get_title() {
    switch ($this->hide_title) {
      case PANELS_TITLE_NONE:
        return '';
      case PANELS_TITLE_PANE:
        return isset($this->stored_pane_title) ? $this->stored_pane_title : '';
      case PANELS_TITLE_FIXED:
      case FALSE:

        // For old exported panels that are not in the database.
        if (!empty($this->title)) {
          return filter_xss_admin(ctools_context_keyword_substitute($this->title, array(), $this->context));
        }
        return NULL;
    }
  }

  /**
   * Render this panels display.
   *
   * After checking to ensure the designated layout plugin is valid, a
   * display renderer object is spawned and runs its rendering logic.
   *
   * @param mixed $renderer
   *    An instantiated display renderer object, or the name of a display
   *    renderer plugin+class to be fetched. Defaults to NULL. When NULL, the
   *    predesignated display renderer will be used.
   */
  function render($renderer = NULL) {
    $layout = panels_get_layout($this->layout);
    if (!$layout) {
      return NULL;
    }

    // If we were not given a renderer object, load it.
    if (!is_object($renderer)) {

      // If the renderer was not specified, default to $this->renderer
      // which is either standard or was already set for us.
      $renderer = panels_get_renderer_handler(!empty($renderer) ? $renderer : $this->renderer, $this);
      if (!$renderer) {
        return NULL;
      }
    }
    $output = '';

    // Let modules act just prior to render.
    foreach (module_implements('panels_pre_render') as $module) {
      $function = $module . '_panels_pre_render';
      $output .= $function($this, $renderer);
    }
    $output .= $renderer
      ->render();

    // Let modules act just after render.
    foreach (module_implements('panels_post_render') as $module) {
      $function = $module . '_panels_post_render';
      $output .= $function($this, $renderer);
    }
    return $output;
  }

}

Members