function panels_ajax_add_pane_config in Panels 6.2
AJAX entry point for to configure a pane that has just been added.
Related topics
1 string reference to 'panels_ajax_add_pane_config'
- panels_menu in ./
panels.module - Implementation of hook_menu
File
- includes/
display-edit.inc, line 472
Code
function panels_ajax_add_pane_config($did = NULL, $panel_id = NULL, $type = NULL, $subtype = NULL) {
panels_load_include('plugins');
panels_load_include('ajax');
if (!is_numeric($did) && $did != 'new' || !($cache = panels_cache_get('display', $did))) {
panels_ajax_render(t('Invalid display id.'));
}
$pane = panels_new_pane($type, $subtype);
$subtypes = panels_ct_get_types($pane->type);
$form_state = array(
'display' => &$cache->display,
'pane' => &$pane,
'ajax' => TRUE,
'title' => t('Configure !subtype_title', array(
'!subtype_title' => $subtypes[$pane->subtype]['title'],
)),
'type' => panels_get_content_type($pane->type),
'subtype' => $subtypes[$pane->subtype],
'op' => 'add',
);
$output = panels_ajax_form_wrapper('panels_content_config_form', $form_state);
if (empty($output)) {
// Get a real pid for this pane.
$pane->pid = "new-" . $cache->display
->next_new_pid();
// Put the pane into the display where it belongs
$pane->panel = $panel_id;
$cache->display->content[$pane->pid] = $pane;
$cache->display->panels[$panel_id][] = $pane->pid;
panels_cache_set('display', $did, $cache);
$output = new stdClass();
$output->type = 'add';
$output->region = "#panel-pane-{$panel_id}";
$output->id = "#panel-pane-{$pane->pid}";
$output->output = panels_show_pane($cache->display, $pane, TRUE);
}
panels_ajax_render($output);
}