function panels_renderer_editor::ajax_access_configure_test in Panels 7.3
Same name and namespace in other branches
- 6.3 plugins/display_renderers/panels_renderer_editor.class.php \panels_renderer_editor::ajax_access_configure_test()
AJAX entry point for to configure vsibility rule.
1 call to panels_renderer_editor::ajax_access_configure_test()
- panels_renderer_editor::ajax_access_add_test in plugins/
display_renderers/ panels_renderer_editor.class.php - AJAX entry point for to add a visibility rule.
File
- plugins/
display_renderers/ panels_renderer_editor.class.php, line 1373 - Class file to control the main Panels editor.
Class
- panels_renderer_editor
- @file Class file to control the main Panels editor.
Code
function ajax_access_configure_test($pid = NULL, $id = NULL) {
if (empty($this->display->content[$pid])) {
ctools_modal_render(t('Error'), t('Invalid pane id.'));
}
$pane =& $this->display->content[$pid];
$subtype = ctools_content_get_subtype($pane->type, $pane->subtype);
// Set this up here because $id gets changed later.
$url = $this
->get_url('access-configure-test', $pid, $id);
// If we're adding a new one, get the stored data from cache and
// add it. It's stored as a cache so that if this is closed
// we don't accidentally add an unconfigured plugin.
if ($id == 'add') {
$pane->access['plugins'][] = $this->cache->new_plugin;
$id = max(array_keys($pane->access['plugins']));
}
elseif (empty($pane->access['plugins'][$id])) {
ctools_modal_render(t('Error'), t('Invalid test id.'));
}
$form_state = array(
'display' => &$this->display,
'pane' => &$pane,
'ajax' => TRUE,
'title' => t('Configure visibility rule for !subtype_title', array(
'!subtype_title' => $subtype['title'],
)),
'test' => &$pane->access['plugins'][$id],
'plugin' => ctools_get_access_plugin($pane->access['plugins'][$id]['name']),
'url' => url($url, array(
'absolute' => TRUE,
)),
);
$output = ctools_modal_form_wrapper('panels_edit_configure_access_test_form', $form_state);
$pane->access['plugins'][$id] = $form_state['test'];
if (empty($form_state['executed'])) {
$this->commands = $output;
return;
}
// Unset the new plugin.
if (isset($this->cache->new_plugin)) {
unset($this->cache->new_plugin);
}
if (!empty($form_state['remove'])) {
unset($pane->access['plugins'][$id]);
}
panels_edit_cache_set($this->cache);
$this
->command_update_pane($pid);
$this->commands[] = ctools_modal_command_dismiss();
}