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($block->content) . '</div>'; $output .= '</div>'; // panel-pane-collapsible $output .= '</div>'; // panel-pane return $output; }
/** * Render pane replacement. * * Parse multilingual config and choose apropriate for current language. */ function render_pane(&$pane) { global $language; // Check if we should skip pane translation. if (_mlpanels_pane_skip($pane->type, $pane->subtype)) { // Pass to default renderer. return parent::render_pane($pane); } // Prepare language dependent config. if (!empty($pane->configuration['mlpanels'])) { $ml_config = $pane->configuration['mlpanels']; $ml_config[LANGUAGE_NONE] = $pane->configuration; unset($ml_config[LANGUAGE_NONE]['mlpanels']); } else { $ml_config[LANGUAGE_NONE] = $pane->configuration; } // Set pane config to render. $pane->configuration = !empty($ml_config[$language->language]) ? $ml_config[$language->language] : $ml_config[LANGUAGE_NONE]; // Pass to default renderer. return parent::render_pane($pane); }