You are here

function panels_ajax_configure_pane 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_configure_pane'
panels_menu in ./panels.module
Implementation of hook_menu

File

includes/display-edit.inc, line 518

Code

function panels_ajax_configure_pane($did = NULL, $pid = 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.'));
  }
  if (empty($cache->display->content[$pid])) {
    panels_ajax_render(t('Invalid pane id.'));
  }
  $pane =& $cache->display->content[$pid];
  $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' => 'edit',
  );
  $output = panels_ajax_form_wrapper('panels_content_config_form', $form_state);
  if (empty($output)) {
    panels_cache_set('display', $did, $cache);
    $output = new stdClass();
    $output->type = 'replace';
    $output->id = "#panel-pane-{$pane->pid}";
    $output->output = panels_show_pane($cache->display, $pane, TRUE);
  }
  panels_ajax_render($output);
}