function render_pane(&$pane)
 {
     // Pass through to normal rendering if not in admin mode.
     if (!$this->admin) {
         return parent::render_pane($pane);
     }
     ctools_include('content');
     $content_type = ctools_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 = ctools_content_admin_title($content_type, $pane->subtype, $pane->configuration, $this->display->context);
     if (!$title) {
         $title = t('Deleted/missing content type @type', array('@type' => $pane->type));
     }
     $buttons = $this->get_pane_links($pane, $content_type);
     // Render administrative buttons for the pane.
     $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.');
     } else {
         $block = ctools_content_admin_info($content_type, $pane->subtype, $pane->configuration, $this->display->context);
     }
     $output = '';
     $class = 'panel-pane';
     if (empty($pane->shown)) {
         $class .= ' hidden-pane';
     }
     if (isset($this->display->title_pane) && $this->display->title_pane == $pane->pid) {
         $class .= ' panel-pane-is-title';
     }
     $output = '<div class="' . $class . '" id="panel-pane-' . $pane->pid . '">';
     if (!$block->title) {
         $block->title = t('No title');
     }
     $output .= '<div class="grabber">';
     if ($buttons) {
         $output .= '<span class="buttons">' . $buttons . '</span>';
     }
     $output .= '<span class="text">' . $title . '</span>';
     $output .= '</div>';
     // grabber
     $output .= '<div class="panel-pane-collapsible">';
     $output .= '<div class="pane-title">' . $block->title . '</div>';
     $output .= '<div class="pane-content">' . filter_xss_admin(render($block->content)) . '</div>';
     $output .= '</div>';
     // panel-pane-collapsible
     $output .= '</div>';
     // panel-pane
     return $output;
 }
Пример #2
0
 function render_pane_content(&$pane)
 {
     $content = parent::render_pane_content($pane);
     // Ensure that empty panes have some content.
     if (empty($content->content)) {
         // Get the administrative title.
         $content_type = ctools_get_content_type($pane->type);
         $title = ctools_content_admin_title($content_type, $pane->subtype, $pane->configuration, $this->display->context);
         $content->content = t('Placeholder for empty "@title"', array('@title' => $title));
         $pane->IPE_empty = TRUE;
     }
     return $content;
 }
 function render_pane_content(&$pane)
 {
     if (!empty($pane->shown) && panels_pane_access($pane, $this->display)) {
         $content = parent::render_pane_content($pane);
     }
     // Ensure that empty panes have some content.
     if (empty($content) || empty($content->content)) {
         if (empty($content)) {
             $content = new stdClass();
         }
         // Get the administrative title.
         $content_type = ctools_get_content_type($pane->type);
         $title = ctools_content_admin_title($content_type, $pane->subtype, $pane->configuration, $this->display->context);
         $content->content = t('Placeholder for empty or inaccessible "@title"', array('@title' => html_entity_decode($title, ENT_QUOTES)));
         // Add these to prevent notices.
         $content->type = 'panels_ipe';
         $content->subtype = 'panels_ipe';
         $pane->IPE_empty = TRUE;
     }
     return $content;
 }
 function render_pane_content(&$pane)
 {
     $content = parent::render_pane_content($pane);
     // Ensure that empty panes have some content.
     if (empty($content) || !is_object($content) || empty($content->content)) {
         if (!is_object($content)) {
             $content = new StdClass();
         }
         // Get the administrative title.
         $content_type = ctools_get_content_type($pane->type);
         $title = ctools_content_admin_title($content_type, $pane->subtype, $pane->configuration, $this->display->context);
         $content->content = t('Placeholder for empty "@title"', array('@title' => $title));
         // Add these to prevent notices.
         $content->type = 'panels_ipe';
         $content->subtype = 'panels_ipe';
         $pane->IPE_empty = TRUE;
     }
     return $content;
 }
 /**
  * AJAX entry point to select the style for a display, region or pane.
  *
  * @param string $type
  *   Either display, region or pane
  * @param $pid
  *   The pane id, if a pane. The region id, if a region.
  */
 function ajax_style_type($type, $pid = NULL)
 {
     // This lets us choose whether we're doing the display's cache or
     // a pane's.
     switch ($type) {
         case 'display':
             $style = isset($this->display->panel_settings['style']) ? $this->display->panel_settings['style'] : 'default';
             $title = t('Default style for this display');
             break;
         case 'region':
             $style = isset($this->display->panel_settings[$pid]['style']) ? $this->display->panel_settings[$pid]['style'] : '-1';
             // -1 signifies to use the default setting.
             $title = t('Panel style for region "!region"', array('!region' => $this->plugins['layout']['regions'][$pid]));
             break;
         case 'pane':
             ctools_include('content');
             $pane =& $this->display->content[$pid];
             $style = isset($pane->style['style']) ? $pane->style['style'] : 'default';
             $title = ctools_content_admin_title($pane->type, $pane->subtype, $pane->configuration, $this->display->context);
             if (!$title) {
                 $title = $pane->type;
             }
             $title = t('Pane style for "!title"', array('!title' => $title));
             break;
         default:
             ctools_modal_render(t('Error'), t('Invalid pane id.'));
     }
     $info = $this->get_style($type, $pid);
     $style_plugin = $info[0];
     $style_settings = $info[1];
     // Backward compatibility: Translate old-style stylizer to new style
     // stylizer.
     if ($style == 'stylizer' && !empty($style_settings['style']) && $style_settings['style'] != '$') {
         $style = 'stylizer:' . $style_settings['style'];
     }
     $form_state = array('display' => &$this->display, 'style' => $style, 'pane' => $type == 'pane' ? $this->display->content[$pid] : NULL, 'title' => $title, 'ajax' => TRUE, 'type' => $type);
     $output = ctools_modal_form_wrapper('panels_edit_style_type_form', $form_state);
     if (empty($form_state['executed'])) {
         $this->commands = $output;
         return;
     }
     // Preserve this; this way we don't actually change the method until they
     // have saved the form.
     $style = panels_get_style($form_state['style']);
     $function = panels_plugin_get_function('styles', $style, $type == 'pane' ? 'pane settings form' : 'settings form');
     if (!$function) {
         if (isset($this->cache->style)) {
             unset($this->cache->style);
         }
         // If there's no settings form, just change the style and exit.
         switch ($type) {
             case 'display':
                 $this->display->panel_settings['style'] = $form_state['style'];
                 if (isset($this->display->panel_settings['style_settings']['default'])) {
                     unset($this->display->panel_settings['style_settings']['default']);
                 }
                 break;
             case 'region':
                 $this->display->panel_settings[$pid]['style'] = $form_state['style'];
                 if (isset($this->display->panel_settings['style_settings'][$pid])) {
                     unset($this->display->panel_settings['style_settings'][$pid]);
                 }
                 break;
             case 'pane':
                 $pane->style['style'] = $form_state['style'];
                 if (isset($pane->style['settings'])) {
                     unset($pane->style['settings']);
                 }
                 break;
         }
         panels_edit_cache_set($this->cache);
         $this->commands[] = ctools_modal_command_dismiss();
         if ($type == 'pane') {
             $this->command_update_pane($pane);
         } else {
             if ($type == 'region') {
                 $this->command_update_region_links($pid);
             } else {
                 $this->command_update_display_links();
             }
         }
     } else {
         if ($form_state['style'] != $form_state['old_style']) {
             $this->cache->style = $form_state['style'];
             panels_edit_cache_set($this->cache);
         }
         // send them to next form.
         return $this->ajax_style_settings($type, $pid);
     }
 }