function panels_renderer_editor::ajax_cache_method in Panels 6.3
Same name and namespace in other branches
- 7.3 plugins/display_renderers/panels_renderer_editor.class.php \panels_renderer_editor::ajax_cache_method()
AJAX entry point to configure the cache method for a pane or the display.
Parameters
string $pid: Either a pane id for a pane in the display, or 'display' to edit the display cache settings.
File
- plugins/
display_renderers/ panels_renderer_editor.class.php, line 841 - Class file to control the main Panels editor.
Class
- panels_renderer_editor
- @file Class file to control the main Panels editor.
Code
function ajax_cache_method($pid = NULL) {
ctools_include('content');
// This lets us choose whether we're doing the display's cache or
// a pane's.
if ($pid == 'display') {
$conf =& $this->display->cache;
$title = t('Cache method for this display');
}
else {
if (!empty($this->display->content[$pid])) {
$pane =& $this->display->content[$pid];
$subtype = ctools_content_get_subtype($pane->type, $pane->subtype);
$conf =& $pane->cache;
$title = t('Cache method for !subtype_title', array(
'!subtype_title' => $subtype['title'],
));
}
else {
ctools_modal_render(t('Error'), t('Invalid pane id.'));
}
}
$form_state = array(
'display' => &$this->display,
'conf' => &$conf,
'title' => $title,
'ajax' => TRUE,
);
$output = ctools_modal_form_wrapper('panels_edit_cache_method_form', $form_state);
if (!empty($output)) {
$this->commands = $output;
return;
}
// Preserve this; this way we don't actually change the method until they
// have saved the form.
$info = panels_get_cache($form_state['method']);
$function = panels_plugin_get_function('cache', $info, 'settings form');
if (!$function) {
$conf['method'] = $form_state['method'];
$conf['settings'] = array();
panels_edit_cache_set($this->cache);
$this->commands[] = ctools_modal_command_dismiss();
if ($pid != 'display') {
$this
->command_update_pane($pane);
}
else {
$this
->command_update_display_links();
}
}
else {
$this->cache->method = $form_state['method'];
panels_edit_cache_set($this->cache);
// send them to next form.
return $this
->ajax_cache_settings($pid);
}
}