You are here

function panels_show_pane in Panels 6.2

Same name and namespace in other branches
  1. 5.2 includes/display_edit.inc \panels_show_pane()
4 calls to panels_show_pane()
panels_ajax_add_pane_config in includes/display-edit.inc
AJAX entry point for to configure a pane that has just been added.
panels_ajax_configure_pane in includes/display-edit.inc
AJAX entry point for to configure a pane that has just been added.
panels_ajax_toggle_shown in includes/display-edit.inc
Entry point for AJAX: toggle pane show/hide status.
theme_panels_edit_display_form in includes/display-edit.inc
Theme the edit display form.

File

includes/display-edit.inc, line 251

Code

function panels_show_pane($display, $pane, $skin = TRUE) {
  $content_type = panels_get_content_type($pane->type);

  // This is just used for the title bar of the pane, not the content itself.
  // If we know the content type, use the appropriate title for that type,
  // otherwise, set the title using the content itself.
  $title = !empty($content_type) ? panels_get_pane_title($pane, $display->context) : $block->title;
  $left_buttons = '';
  $buttons = '';

  // Render administrative buttons for the pane.
  // On the left we have the 'caching' link.
  if (panels_get_caches() && user_access('use panels caching features')) {
    $buttons .= panels_ajax_image_button('icon-cache.png', "panels/ajax/cache-method/{$display->did}/{$pane->pid}", t('Set caching options for "@pane"', array(
      '@pane' => $title,
    )), "pane-cache-link");
  }

  // Next to it the show or hide pane link
  if (!empty($pane->shown)) {
    $buttons .= panels_ajax_image_button('icon-hidepane.png', "panels/ajax/hide/{$display->did}/{$pane->pid}", t('Hide "@pane"', array(
      '@pane' => $title,
    )), "pane-toggle-shown-link panels-no-modal");
  }
  else {
    $buttons .= panels_ajax_image_button('icon-showpane.png', "panels/ajax/show/{$display->did}/{$pane->pid}", t('Show "@pane"', array(
      '@pane' => $title,
    )), "pane-toggle-shown-link panels-no-modal");
  }

  // And the configure settings link
  $buttons .= panels_ajax_image_button('icon-configure.png', "panels/ajax/configure/{$display->did}/{$pane->pid}", t('Configure settings for "@pane"', array(
    '@pane' => $title,
  )), "pane-configure-link");

  // The delete button doesn't use panels_ajax_image_button because it doesn't
  // actually perform an ajax call.
  $alt = t('Delete pane "@pane"', array(
    '@pane' => $title,
  ));
  $buttons .= l(theme('image', panels_get_path("images/icon-delete.png")), '', array(
    'html' => TRUE,
    'attributes' => array(
      'class' => 'pane-delete',
      'id' => "pane-delete-panel-pane-{$pane->pid}",
      'title' => $alt,
      'alt' => $alt,
    ),
  ));
  $block = new stdClass();
  if (empty($content_type)) {
    $block->title = '<em>' . t('Missing content type') . '</em>';
    $block->content = t('This pane\'s content type is either missing or has been deleted. This pane will not render.');
  }
  elseif (isset($content_type['editor render callback']) && function_exists($content_type['editor render callback'])) {
    $block = $content_type['editor render callback']($display, $pane);
  }
  else {
    $block = _panels_render_preview_pane_disabled($pane, $display->context);
  }
  $output = theme('panels_pane_dnd', $block, $pane->pid, $title, $left_buttons, $buttons);
  if ($skin) {
    $class = 'panel-pane' . ($pane->shown ? '' : ' hidden-pane');
    $output = '<div class="' . $class . '" id="panel-pane-' . $pane->pid . '">' . $output . '</div>';
  }
  return $output;
}