contrib modules security updates
This commit is contained in:
@@ -61,6 +61,7 @@ class panels_renderer_editor extends panels_renderer_standard {
|
||||
ctools_add_js('display_editor', 'panels');
|
||||
ctools_add_css('panels_dnd', 'panels');
|
||||
ctools_add_css('panels_admin', 'panels');
|
||||
drupal_add_library('system', 'ui');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -161,7 +162,7 @@ class panels_renderer_editor extends panels_renderer_standard {
|
||||
if ($buttons) {
|
||||
$output .= '<span class="buttons">' . $buttons . '</span>';
|
||||
}
|
||||
$output .= '<span class="text">' . $title . '</span>';
|
||||
$output .= '<span class="text" title="' . check_plain($title) . '">' . $title . '</span>';
|
||||
$output .= '</div>'; // grabber
|
||||
|
||||
$output .= '<div class="panel-pane-collapsible">';
|
||||
@@ -186,12 +187,12 @@ class panels_renderer_editor extends panels_renderer_standard {
|
||||
|
||||
$style_title = isset($style['title']) ? $style['title'] : t('Default');
|
||||
|
||||
$style_links[] = array(
|
||||
$style_links['title'] = array(
|
||||
'title' => $style_title,
|
||||
'attributes' => array('class' => array('panels-text')),
|
||||
);
|
||||
|
||||
$style_links[] = array(
|
||||
$style_links['change'] = array(
|
||||
'title' => t('Change'),
|
||||
'href' => $this->get_url('style-type', $type, $id),
|
||||
'attributes' => array('class' => array('ctools-use-modal')),
|
||||
@@ -199,7 +200,7 @@ class panels_renderer_editor extends panels_renderer_standard {
|
||||
|
||||
$function = $type != 'pane' ? 'settings form' : 'pane settings form';
|
||||
if (panels_plugin_get_function('styles', $style, $function)) {
|
||||
$style_links[] = array(
|
||||
$style_links['settings'] = array(
|
||||
'title' => t('Settings'),
|
||||
'href' => $this->get_url('style-settings', $type, $id),
|
||||
'attributes' => array('class' => array('ctools-use-modal')),
|
||||
@@ -307,14 +308,14 @@ class panels_renderer_editor extends panels_renderer_standard {
|
||||
$links = array();
|
||||
|
||||
if (!empty($pane->shown)) {
|
||||
$links[] = array(
|
||||
$links['top']['disabled'] = array(
|
||||
'title' => t('Disable this pane'),
|
||||
'href' => $this->get_url('hide', $pane->pid),
|
||||
'attributes' => array('class' => array('use-ajax')),
|
||||
);
|
||||
}
|
||||
else {
|
||||
$links[] = array(
|
||||
$links['top']['enable'] = array(
|
||||
'title' => t('Enable this pane'),
|
||||
'href' => $this->get_url('show', $pane->pid),
|
||||
'attributes' => array('class' => array('use-ajax')),
|
||||
@@ -322,13 +323,13 @@ class panels_renderer_editor extends panels_renderer_standard {
|
||||
}
|
||||
|
||||
if (isset($this->display->title_pane) && $this->display->title_pane == $pane->pid) {
|
||||
$links['panels-set-title'] = array(
|
||||
$links['top']['panels-set-title'] = array(
|
||||
'title' => t('✓Panel title'),
|
||||
'html' => TRUE,
|
||||
);
|
||||
}
|
||||
else {
|
||||
$links['panels-set-title'] = array(
|
||||
$links['top']['panels-set-title'] = array(
|
||||
'title' => t('Panel title'),
|
||||
'href' => $this->get_url('panel-title', $pane->pid),
|
||||
'attributes' => array('class' => array('use-ajax')),
|
||||
@@ -338,7 +339,7 @@ class panels_renderer_editor extends panels_renderer_standard {
|
||||
$subtype = ctools_content_get_subtype($content_type, $pane->subtype);
|
||||
|
||||
if (ctools_content_editable($content_type, $subtype, $pane->configuration)) {
|
||||
$links[] = array(
|
||||
$links['top']['settings'] = array(
|
||||
'title' => isset($content_type['edit text']) ? $content_type['edit text'] : t('Settings'),
|
||||
'href' => $this->get_url('edit-pane', $pane->pid),
|
||||
'attributes' => array('class' => array('ctools-use-modal')),
|
||||
@@ -346,7 +347,7 @@ class panels_renderer_editor extends panels_renderer_standard {
|
||||
}
|
||||
|
||||
if (user_access('administer advanced pane settings')) {
|
||||
$links[] = array(
|
||||
$links['top']['css'] = array(
|
||||
'title' => t('CSS properties'),
|
||||
'href' => $this->get_url('pane-css', $pane->pid),
|
||||
'attributes' => array('class' => array('ctools-use-modal')),
|
||||
@@ -354,26 +355,10 @@ class panels_renderer_editor extends panels_renderer_standard {
|
||||
}
|
||||
|
||||
if (user_access('administer panels styles')) {
|
||||
$links[] = array(
|
||||
'title' => '<hr />',
|
||||
'html' => TRUE,
|
||||
);
|
||||
|
||||
$style_links = $this->get_style_links('pane', $pane->pid);
|
||||
|
||||
$links[] = array(
|
||||
'title' => '<span class="dropdown-header">' . t('Style') . '</span>' . theme_links(array('links' => $style_links, 'attributes' => array(), 'heading' => array())),
|
||||
'html' => TRUE,
|
||||
'attributes' => array('class' => array('panels-sub-menu')),
|
||||
);
|
||||
$links['style'] = $this->get_style_links('pane', $pane->pid);
|
||||
}
|
||||
|
||||
if (user_access('administer pane access')) {
|
||||
$links[] = array(
|
||||
'title' => '<hr />',
|
||||
'html' => TRUE,
|
||||
);
|
||||
|
||||
$contexts = $this->display->context;
|
||||
// Make sure we have the logged in user context
|
||||
if (!isset($contexts['logged-in-user'])) {
|
||||
@@ -385,7 +370,7 @@ class panels_renderer_editor extends panels_renderer_standard {
|
||||
if (!empty($pane->access['plugins'])) {
|
||||
foreach ($pane->access['plugins'] as $id => $test) {
|
||||
$plugin = ctools_get_access_plugin($test['name']);
|
||||
$access_title = isset($plugin['title']) ? $plugin['title'] : t('Broken/missing access plugin %plugin', array('%plugin' => $test['name']));
|
||||
$access_title = isset($plugin['title']) ? $plugin['title'] : t('Broken/missing access plugin %plugin', array('%plugin' => $test['name']));
|
||||
$access_description = ctools_access_summary($plugin, $contexts, $test);
|
||||
|
||||
$visibility_links[] = array(
|
||||
@@ -396,37 +381,28 @@ class panels_renderer_editor extends panels_renderer_standard {
|
||||
}
|
||||
}
|
||||
if (empty($visibility_links)) {
|
||||
$visibility_links[] = array(
|
||||
$visibility_links['no_rules'] = array(
|
||||
'title' => t('No rules'),
|
||||
'attributes' => array('class' => array('panels-text')),
|
||||
);
|
||||
}
|
||||
|
||||
$visibility_links[] = array(
|
||||
$visibility_links['add_rule'] = array(
|
||||
'title' => t('Add new rule'),
|
||||
'href' => $this->get_url('access-add-test', $pane->pid),
|
||||
'attributes' => array('class' => array('ctools-use-modal')),
|
||||
);
|
||||
|
||||
$visibility_links[] = array(
|
||||
$visibility_links['settings'] = array(
|
||||
'title' => t('Settings'),
|
||||
'href' => $this->get_url('access-settings', $pane->pid),
|
||||
'attributes' => array('class' => array('ctools-use-modal')),
|
||||
);
|
||||
|
||||
$links[] = array(
|
||||
'title' => '<span class="dropdown-header">' . t('Visibility rules') . '</span>' . theme_links(array('links' => $visibility_links, 'attributes' => array(), 'heading' => array())),
|
||||
'html' => TRUE,
|
||||
'attributes' => array('class' => array('panels-sub-menu')),
|
||||
);
|
||||
$links['visibility'] = $visibility_links;
|
||||
}
|
||||
|
||||
if (user_access('use panels locks')) {
|
||||
$links[] = array(
|
||||
'title' => '<hr />',
|
||||
'html' => TRUE,
|
||||
);
|
||||
|
||||
$lock_type = !empty($pane->locks['type']) ? $pane->locks['type'] : 'none';
|
||||
switch ($lock_type) {
|
||||
case 'immovable':
|
||||
@@ -441,62 +417,44 @@ class panels_renderer_editor extends panels_renderer_standard {
|
||||
break;
|
||||
}
|
||||
|
||||
$lock_links[] = array(
|
||||
$lock_links['lock'] = array(
|
||||
'title' => $lock_method,
|
||||
'attributes' => array('class' => array('panels-text')),
|
||||
);
|
||||
$lock_links[] = array(
|
||||
$lock_links['change'] = array(
|
||||
'title' => t('Change'),
|
||||
'href' => $this->get_url('lock', $pane->pid),
|
||||
'attributes' => array('class' => array('ctools-use-modal')),
|
||||
);
|
||||
|
||||
$links[] = array(
|
||||
'title' => '<span class="dropdown-header">' . t('Locking') . '</span>' . theme_links(array('links' => $lock_links, 'attributes' => array(), 'heading' => array())),
|
||||
'html' => TRUE,
|
||||
'attributes' => array('class' => array('panels-sub-menu')),
|
||||
);
|
||||
$links['lock'] = $lock_links;
|
||||
}
|
||||
|
||||
if (panels_get_caches() && user_access('use panels caching features')) {
|
||||
$links[] = array(
|
||||
'title' => '<hr />',
|
||||
'html' => TRUE,
|
||||
);
|
||||
|
||||
$method = isset($pane->cache['method']) ? $pane->cache['method'] : 0;
|
||||
$info = panels_get_cache($method);
|
||||
$cache_method = isset($info['title']) ? $info['title'] : t('No caching');
|
||||
$cache_links[] = array(
|
||||
$cache_links['title'] = array(
|
||||
'title' => $cache_method,
|
||||
'attributes' => array('class' => array('panels-text')),
|
||||
);
|
||||
$cache_links[] = array(
|
||||
$cache_links['change'] = array(
|
||||
'title' => t('Change'),
|
||||
'href' => $this->get_url('cache-method', $pane->pid),
|
||||
'attributes' => array('class' => array('ctools-use-modal')),
|
||||
);
|
||||
if (panels_plugin_get_function('cache', $info, 'settings form')) {
|
||||
$cache_links[] = array(
|
||||
$cache_links['settings'] = array(
|
||||
'title' => t('Settings'),
|
||||
'href' => $this->get_url('cache-settings', $pane->pid),
|
||||
'attributes' => array('class' => array('ctools-use-modal')),
|
||||
);
|
||||
}
|
||||
|
||||
$links[] = array(
|
||||
'title' => '<span class="dropdown-header">' . t('Caching') . '</span>' . theme_links(array('links' => $cache_links, 'attributes' => array(), 'heading' => array())),
|
||||
'html' => TRUE,
|
||||
'attributes' => array('class' => array('panels-sub-menu')),
|
||||
);
|
||||
$links['cache'] = $cache_links;
|
||||
}
|
||||
|
||||
$links[] = array(
|
||||
'title' => '<hr />',
|
||||
'html' => TRUE,
|
||||
);
|
||||
|
||||
$links[] = array(
|
||||
$links['bottom']['remove'] = array(
|
||||
'title' => t('Remove'),
|
||||
'href' => '#',
|
||||
'attributes' => array(
|
||||
@@ -505,7 +463,38 @@ class panels_renderer_editor extends panels_renderer_standard {
|
||||
),
|
||||
);
|
||||
|
||||
return theme('ctools_dropdown', array('title' => theme('image', array('path' => ctools_image_path('icon-configure.png', 'panels'))), 'links' => $links, 'image' => TRUE));
|
||||
// Allow others to add/remove links from pane context menu.
|
||||
// Grouped by 'top', 'style', 'visibility', 'lock', 'cache' and 'bottom'
|
||||
drupal_alter('get_pane_links', $links, $pane, $content_type);
|
||||
|
||||
$dropdown_links = $links['top'];
|
||||
$category_labels = array(
|
||||
'style' => 'Style',
|
||||
'visibility' => 'Visibility rules',
|
||||
'lock' => 'Locking',
|
||||
'cache' => 'Caching',
|
||||
);
|
||||
foreach ($category_labels as $category => $label) {
|
||||
if (array_key_exists($category, $links)) {
|
||||
$dropdown_links[] = array(
|
||||
'title' => '<hr />',
|
||||
'html' => TRUE,
|
||||
);
|
||||
$dropdown_links[] = array(
|
||||
'title' => '<span class="dropdown-header">' . t($label) . '</span>' . theme_links(array('links' => $links[$category], 'attributes' => array(), 'heading' => array())),
|
||||
'html' => TRUE,
|
||||
'attributes' => array('class' => array('panels-sub-menu')),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
$dropdown_links[] = array(
|
||||
'title' => '<hr />',
|
||||
'html' => TRUE,
|
||||
);
|
||||
$dropdown_links = array_merge($dropdown_links, $links['bottom']);
|
||||
|
||||
return theme('ctools_dropdown', array('title' => theme('image', array('path' => ctools_image_path('icon-configure.png', 'panels'))), 'links' => $dropdown_links, 'image' => TRUE));
|
||||
}
|
||||
|
||||
// -----------------------------------------------------------------------
|
||||
@@ -525,6 +514,40 @@ class panels_renderer_editor extends panels_renderer_standard {
|
||||
return $url;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the Panels storage oparation for a given renderer AJAX method.
|
||||
*
|
||||
* @param string $method
|
||||
* The method name.
|
||||
*
|
||||
* @return string
|
||||
* The Panels storage op.
|
||||
*/
|
||||
function get_panels_storage_op_for_ajax($method) {
|
||||
switch ($method) {
|
||||
case 'ajax_show':
|
||||
case 'ajax_hide':
|
||||
case 'ajax_select_content':
|
||||
case 'ajax_add_pane':
|
||||
case 'ajax_edit_pane':
|
||||
case 'ajax_panel_title':
|
||||
case 'ajax_cache_method':
|
||||
case 'ajax_cache_settings':
|
||||
case 'ajax_style_type':
|
||||
case 'ajax_style_settings':
|
||||
case 'ajax_pane_css':
|
||||
case 'ajax_lock':
|
||||
case 'ajax_access_settings':
|
||||
case 'ajax_access_add_test':
|
||||
case 'ajax_access_configure_test':
|
||||
case 'ajax_layout':
|
||||
case 'ajax_style':
|
||||
return 'update';
|
||||
}
|
||||
|
||||
return parent::get_panels_storage_op_for_ajax($method);
|
||||
}
|
||||
|
||||
/**
|
||||
* AJAX command to show a pane.
|
||||
*/
|
||||
@@ -572,6 +595,11 @@ class panels_renderer_editor extends panels_renderer_standard {
|
||||
$output = theme('panels_add_content_modal', array('renderer' => $this, 'categories' => $categories, 'category' => $category, 'region' => $region));
|
||||
}
|
||||
$this->commands[] = ctools_modal_command_display($title, $output);
|
||||
|
||||
// Give keybord focus to the first item in the category we just loaded.
|
||||
if (!empty($category)) {
|
||||
$this->commands[] = ajax_command_invoke(".panels-add-content-modal .panels-section-columns :focusable:first", 'focus');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -656,7 +684,19 @@ class panels_renderer_editor extends panels_renderer_standard {
|
||||
$content_type = ctools_get_content_type($type_name);
|
||||
$subtype = ctools_content_get_subtype($content_type, $subtype_name);
|
||||
|
||||
if (!isset($step) || !isset($this->cache->new_pane)) {
|
||||
// Determine if we are adding a different pane than previously cached. This
|
||||
// is used to load the different pane into cache so that multistep forms
|
||||
// have the correct context instead of a previously cached version that
|
||||
// does not match the pane currently being added.
|
||||
$is_different_pane = FALSE;
|
||||
if (isset($this->cache) && isset($this->cache->new_pane)) {
|
||||
$diff_type = $type_name != $this->cache->new_pane->type;
|
||||
$diff_subtype = $subtype_name != $this->cache->new_pane->subtype;
|
||||
|
||||
$is_different_pane = $diff_type || $diff_subtype;
|
||||
}
|
||||
|
||||
if (!isset($step) || !isset($this->cache->new_pane) || $is_different_pane) {
|
||||
$pane = panels_new_pane($type_name, $subtype_name, TRUE);
|
||||
$this->cache->new_pane = &$pane;
|
||||
}
|
||||
@@ -947,8 +987,11 @@ class panels_renderer_editor extends panels_renderer_standard {
|
||||
ctools_include('content');
|
||||
$pane = &$this->display->content[$pid];
|
||||
$style = isset($pane->style['style']) ? $pane->style['style'] : 'default';
|
||||
$subtype = ctools_content_get_subtype($pane->type, $pane->subtype);
|
||||
$title = t('Pane style for "!pane"', array('!pane' => $subtype['title']));
|
||||
$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:
|
||||
@@ -1163,9 +1206,21 @@ class panels_renderer_editor extends panels_renderer_standard {
|
||||
unset($this->cache->style);
|
||||
}
|
||||
|
||||
if (!empty($form_state['cancel'])) {
|
||||
// The cache must be saved prior to dismissing the modal.
|
||||
panels_edit_cache_set($this->cache);
|
||||
$this->commands[] = ctools_modal_command_dismiss();
|
||||
return;
|
||||
}
|
||||
|
||||
// Copy settings from form state back into the cache.
|
||||
if(!empty($form_state['values']['settings'])) {
|
||||
$this->cache->display->content[$pid]->style['settings'] = $form_state['values']['settings'];
|
||||
if ($type == 'pane') {
|
||||
$this->cache->display->content[$pid]->style['settings'] = $form_state['values']['settings'];
|
||||
}
|
||||
else if($type == 'region') {
|
||||
$this->cache->display->panel_settings['style_settings'][$pid] = $form_state['values']['settings'];
|
||||
}
|
||||
}
|
||||
|
||||
panels_edit_cache_set($this->cache);
|
||||
@@ -1485,7 +1540,7 @@ function panels_ajax_edit_pane_next(&$form_state) {
|
||||
}
|
||||
|
||||
/**
|
||||
* Handle the 'finish' click on teh add/edit pane form wizard.
|
||||
* Handle the 'finish' click on the add/edit pane form wizard.
|
||||
*
|
||||
* All we need to do is set a flag so the return can handle adding
|
||||
* the pane.
|
||||
@@ -1510,6 +1565,8 @@ function panels_ajax_edit_pane_cancel(&$form_state) {
|
||||
* Choose cache method form
|
||||
*/
|
||||
function panels_edit_cache_method_form($form, &$form_state) {
|
||||
ctools_form_include($form_state, 'plugins', 'panels');
|
||||
form_load_include($form_state, 'php', 'panels', '/plugins/display_renderers/panels_renderer_editor.class');
|
||||
$display = &$form_state['display'];
|
||||
$conf = &$form_state['conf'];
|
||||
|
||||
@@ -1558,6 +1615,8 @@ function panels_edit_cache_method_form_submit($form, &$form_state) {
|
||||
* Cache settings form
|
||||
*/
|
||||
function panels_edit_cache_settings_form($form, &$form_state) {
|
||||
ctools_form_include($form_state, 'plugins', 'panels');
|
||||
form_load_include($form_state, 'php', 'panels', '/plugins/display_renderers/panels_renderer_editor.class');
|
||||
$display = &$form_state['display'];
|
||||
$conf = &$form_state['conf'];
|
||||
$pid = $form_state['pid'];
|
||||
@@ -1618,6 +1677,8 @@ function panels_edit_cache_settings_form_submit($form, &$form_state) {
|
||||
* Choose style form
|
||||
*/
|
||||
function panels_edit_style_type_form($form, &$form_state) {
|
||||
ctools_form_include($form_state, 'plugins', 'panels');
|
||||
form_load_include($form_state, 'php', 'panels', '/plugins/display_renderers/panels_renderer_editor.class');
|
||||
$display = &$form_state['display'];
|
||||
$style = $form_state['style'];
|
||||
$type = $form_state['type'];
|
||||
@@ -1668,6 +1729,8 @@ function panels_edit_style_type_form_submit($form, &$form_state) {
|
||||
* Style settings form
|
||||
*/
|
||||
function panels_edit_style_settings_form($form, &$form_state) {
|
||||
ctools_form_include($form_state, 'plugins', 'panels');
|
||||
form_load_include($form_state, 'php', 'panels', '/plugins/display_renderers/panels_renderer_editor.class');
|
||||
$display = &$form_state['display'];
|
||||
$conf = &$form_state['conf'];
|
||||
$pid = $form_state['pid'];
|
||||
@@ -1692,9 +1755,28 @@ function panels_edit_style_settings_form($form, &$form_state) {
|
||||
'#value' => t('Save'),
|
||||
);
|
||||
|
||||
|
||||
// Need a cancel button since the style cache can persist and impact the wrong
|
||||
// pane (or region, or display).
|
||||
$form['cancel_style'] = array(
|
||||
'#type' => 'submit',
|
||||
'#value' => t('Cancel'),
|
||||
'#submit' => array('panels_edit_style_settings_form_cancel'),
|
||||
);
|
||||
|
||||
return $form;
|
||||
}
|
||||
|
||||
/**
|
||||
* Cancel style settings form.
|
||||
*
|
||||
* Clears the editing cache to prevent styles being applied to incorrect regions
|
||||
* or panes.
|
||||
*/
|
||||
function panels_edit_style_settings_form_cancel($form, &$form_state) {
|
||||
$form_state['cancel'] = TRUE;
|
||||
}
|
||||
|
||||
/**
|
||||
* Validate style settings.
|
||||
*/
|
||||
@@ -1722,6 +1804,8 @@ function panels_edit_style_settings_form_submit($form, &$form_state) {
|
||||
* Configure CSS on a pane form.
|
||||
*/
|
||||
function panels_edit_configure_pane_css_form($form, &$form_state) {
|
||||
ctools_form_include($form_state, 'plugins', 'panels');
|
||||
form_load_include($form_state, 'php', 'panels', '/plugins/display_renderers/panels_renderer_editor.class');
|
||||
$display = &$form_state['display'];
|
||||
$pane = &$form_state['pane'];
|
||||
|
||||
@@ -1729,13 +1813,13 @@ function panels_edit_configure_pane_css_form($form, &$form_state) {
|
||||
'#type' => 'textfield',
|
||||
'#default_value' => isset($pane->css['css_id']) ? $pane->css['css_id'] : '',
|
||||
'#title' => t('CSS ID'),
|
||||
'#description' => t('CSS ID to apply to this pane. This may be blank.'),
|
||||
'#description' => t('CSS ID to apply to this pane. This may be blank. Keywords from context are allowed.'),
|
||||
);
|
||||
$form['css_class'] = array(
|
||||
'#type' => 'textfield',
|
||||
'#default_value' => isset($pane->css['css_class']) ? $pane->css['css_class'] : '',
|
||||
'#title' => t('CSS class'),
|
||||
'#description' => t('CSS class to apply to this pane. This may be blank.'),
|
||||
'#description' => t('CSS class to apply to this pane. This may be blank. Keywords from context are allowed.'),
|
||||
);
|
||||
|
||||
$form['next'] = array(
|
||||
@@ -1764,6 +1848,8 @@ function panels_edit_configure_pane_css_form_submit($form, &$form_state) {
|
||||
* Configure lock on a pane form.
|
||||
*/
|
||||
function panels_edit_configure_pane_lock_form($form, &$form_state) {
|
||||
ctools_form_include($form_state, 'plugins', 'panels');
|
||||
form_load_include($form_state, 'php', 'panels', '/plugins/display_renderers/panels_renderer_editor.class');
|
||||
$display = &$form_state['display'];
|
||||
$pane = &$form_state['pane'];
|
||||
|
||||
@@ -1839,6 +1925,8 @@ function panels_edit_configure_pane_lock_form_submit($form, &$form_state) {
|
||||
* Form to control basic visibility settings.
|
||||
*/
|
||||
function panels_edit_configure_access_settings_form($form, &$form_state) {
|
||||
ctools_form_include($form_state, 'plugins', 'panels');
|
||||
form_load_include($form_state, 'php', 'panels', '/plugins/display_renderers/panels_renderer_editor.class');
|
||||
$display = &$form_state['display'];
|
||||
$pane = &$form_state['pane'];
|
||||
|
||||
@@ -1876,6 +1964,8 @@ function panels_edit_configure_access_settings_form_submit($form, &$form_state)
|
||||
* Form to add a visibility rule.
|
||||
*/
|
||||
function panels_edit_add_access_test_form($form, &$form_state) {
|
||||
ctools_form_include($form_state, 'plugins', 'panels');
|
||||
form_load_include($form_state, 'php', 'panels', '/plugins/display_renderers/panels_renderer_editor.class');
|
||||
$display = &$form_state['display'];
|
||||
$pane = &$form_state['pane'];
|
||||
|
||||
@@ -1905,6 +1995,8 @@ function panels_edit_add_access_test_form($form, &$form_state) {
|
||||
* Form to configure a visibility rule.
|
||||
*/
|
||||
function panels_edit_configure_access_test_form($form, &$form_state) {
|
||||
ctools_form_include($form_state, 'plugins', 'panels');
|
||||
form_load_include($form_state, 'php', 'panels', '/plugins/display_renderers/panels_renderer_editor.class');
|
||||
$display = &$form_state['display'];
|
||||
$test = &$form_state['test'];
|
||||
$plugin = &$form_state['plugin'];
|
||||
|
@@ -151,6 +151,15 @@ class panels_renderer_standard {
|
||||
*/
|
||||
var $suffix = '';
|
||||
|
||||
/**
|
||||
* Boolean flag indicating whether to render the layout even if all rendered
|
||||
* regions are blank. If FALSE, the layout renders as an empty string (without
|
||||
* prefix or suffix) if not in administrative mode.
|
||||
*
|
||||
* @var bool
|
||||
*/
|
||||
var $show_empty_layout = TRUE;
|
||||
|
||||
/**
|
||||
* Receive and store the display object to be rendered.
|
||||
*
|
||||
@@ -176,6 +185,19 @@ class panels_renderer_standard {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the Panels storage oparation for a given renderer AJAX method.
|
||||
*
|
||||
* @param string $method
|
||||
* The method name.
|
||||
*
|
||||
* @return string
|
||||
* The Panels storage op.
|
||||
*/
|
||||
function get_panels_storage_op_for_ajax($method) {
|
||||
return 'read';
|
||||
}
|
||||
|
||||
/**
|
||||
* Prepare the attached display for rendering.
|
||||
*
|
||||
@@ -396,6 +418,22 @@ class panels_renderer_standard {
|
||||
$theme = $this->plugins['layout']['theme'];
|
||||
}
|
||||
|
||||
// Determine whether to render layout.
|
||||
$show = TRUE;
|
||||
if (!$this->show_empty_layout && !$this->admin) {
|
||||
$show = FALSE;
|
||||
// Render layout if any region is not empty.
|
||||
foreach ($this->rendered['regions'] as $region) {
|
||||
if (is_string($region) && $region !== '') {
|
||||
$show = TRUE;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!$show) {
|
||||
return;
|
||||
}
|
||||
|
||||
$this->rendered['layout'] = theme($theme, array('css_id' => check_plain($this->display->css_id), 'content' => $this->rendered['regions'], 'settings' => $this->display->layout_settings, 'display' => $this->display, 'layout' => $this->plugins['layout'], 'renderer' => $this));
|
||||
return $this->prefix . $this->rendered['layout'] . $this->suffix;
|
||||
}
|
||||
@@ -407,17 +445,38 @@ class panels_renderer_standard {
|
||||
* their CSS added in the right order: inner content before outer content.
|
||||
*/
|
||||
function add_meta() {
|
||||
global $theme;
|
||||
|
||||
if (!empty($this->plugins['layout']['css'])) {
|
||||
if (file_exists(path_to_theme() . '/' . $this->plugins['layout']['css'])) {
|
||||
$this->add_css(path_to_theme() . '/' . $this->plugins['layout']['css']);
|
||||
// Do not use the path_to_theme() function, because it returns the
|
||||
// $GLOBALS['theme_path'] value, which may be overriden in the theme()
|
||||
// function when the theme hook defines the key 'theme path'.
|
||||
$theme_path = isset($theme) ? drupal_get_path('theme', $theme) : '';
|
||||
|
||||
$css = $this->plugins['layout']['css'];
|
||||
if (!is_array($css)) {
|
||||
$css = array($css);
|
||||
}
|
||||
else {
|
||||
$this->add_css($this->plugins['layout']['path'] . '/' . $this->plugins['layout']['css']);
|
||||
|
||||
// Load each of the CSS files defined in this layout.
|
||||
foreach ($css as $file) {
|
||||
if (!empty($theme_path) && file_exists($theme_path . '/' . $file)) {
|
||||
$this->add_css($theme_path . '/' . $file);
|
||||
}
|
||||
else {
|
||||
$this->add_css($this->plugins['layout']['path'] . '/' . $file);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ($this->admin && isset($this->plugins['layout']['admin css'])) {
|
||||
$this->add_css($this->plugins['layout']['path'] . '/' . $this->plugins['layout']['admin css']);
|
||||
$admin_css = $this->plugins['layout']['admin css'];
|
||||
if (!is_array($admin_css)) {
|
||||
$admin_css = array($admin_css);
|
||||
}
|
||||
foreach ($admin_css as $file) {
|
||||
$this->add_css($this->plugins['layout']['path'] . '/' . $file);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -453,6 +512,7 @@ class panels_renderer_standard {
|
||||
* The array of rendered panes, keyed on pane pid.
|
||||
*/
|
||||
function render_panes() {
|
||||
drupal_alter('panels_prerender_panes', $this);
|
||||
ctools_include('content');
|
||||
|
||||
// First, render all the panes into little boxes.
|
||||
@@ -477,6 +537,8 @@ class panels_renderer_standard {
|
||||
* A Panels pane object, as loaded from the database.
|
||||
*/
|
||||
function render_pane(&$pane) {
|
||||
module_invoke_all('panels_pane_prerender', $pane);
|
||||
|
||||
$content = $this->render_pane_content($pane);
|
||||
if ($this->display->hide_title == PANELS_TITLE_PANE && !empty($this->display->title_pane) && $this->display->title_pane == $pane->pid) {
|
||||
|
||||
@@ -530,7 +592,6 @@ class panels_renderer_standard {
|
||||
$this->display->context = array();
|
||||
}
|
||||
|
||||
$content = FALSE;
|
||||
$caching = !empty($pane->cache['method']) && empty($this->display->skip_cache);
|
||||
if ($caching && ($cache = panels_get_cached_content($this->display, $this->display->args, $this->display->context, $pane))) {
|
||||
$content = $cache->content;
|
||||
@@ -544,10 +605,6 @@ class panels_renderer_standard {
|
||||
|
||||
$content = ctools_content_render($pane->type, $pane->subtype, $pane->configuration, array(), $this->display->args, $this->display->context);
|
||||
|
||||
if (empty($content)) {
|
||||
return;
|
||||
}
|
||||
|
||||
foreach (module_implements('panels_pane_content_alter') as $module) {
|
||||
$function = $module . '_panels_pane_content_alter';
|
||||
$function($content, $pane, $this->display->args, $this->display->context, $this, $this->display);
|
||||
@@ -559,14 +616,19 @@ class panels_renderer_standard {
|
||||
}
|
||||
}
|
||||
|
||||
// Pass long the css_id that is usually available.
|
||||
if (!empty($pane->css['css_id'])) {
|
||||
$content->css_id = check_plain($pane->css['css_id']);
|
||||
}
|
||||
// If there's content, check if we've css configuration to add.
|
||||
if (!empty($content)) {
|
||||
// Pass long the css_id that is usually available.
|
||||
if (!empty($pane->css['css_id'])) {
|
||||
$id = ctools_context_keyword_substitute($pane->css['css_id'], array(), $this->display->context);
|
||||
$content->css_id = check_plain($id);
|
||||
}
|
||||
|
||||
// Pass long the css_class that is usually available.
|
||||
if (!empty($pane->css['css_class'])) {
|
||||
$content->css_class = check_plain($pane->css['css_class']);
|
||||
// Pass long the css_class that is usually available.
|
||||
if (!empty($pane->css['css_class'])) {
|
||||
$class = ctools_context_keyword_substitute($pane->css['css_class'], array(), $this->display->context, array('css safe' => TRUE));
|
||||
$content->css_class = check_plain($class);
|
||||
}
|
||||
}
|
||||
|
||||
return $content;
|
||||
@@ -580,6 +642,7 @@ class panels_renderer_standard {
|
||||
* An array of rendered panel regions, keyed on the region name.
|
||||
*/
|
||||
function render_regions() {
|
||||
drupal_alter('panels_prerender_regions', $this);
|
||||
$this->rendered['regions'] = array();
|
||||
|
||||
// Loop through all panel regions, put all panes that belong to the current
|
||||
|
Reference in New Issue
Block a user