function panels_renderer_editor::ajax_access_add_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_add_test()
AJAX entry point for to add a visibility rule.
File
- plugins/
display_renderers/ panels_renderer_editor.class.php, line 1341 - 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_add_test($pid = 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);
$form_state = array(
'display' => &$this->display,
'pane' => &$pane,
'ajax' => TRUE,
'title' => t('Add visibility rule for !subtype_title', array(
'!subtype_title' => $subtype['title'],
)),
);
$output = ctools_modal_form_wrapper('panels_edit_add_access_test_form', $form_state);
if (!empty($form_state['executed'])) {
// Set up the plugin in cache.
$plugin = ctools_get_access_plugin($form_state['values']['type']);
$this->cache->new_plugin = ctools_access_new_test($plugin);
panels_edit_cache_set($this->cache);
// Go to the next step.
return $this
->ajax_access_configure_test($pid, 'add');
}
$this->commands = $output;
}