You are here

function panels_ajax_configure in Panels 5.2

Entry point for AJAX: Edit pane configuration.

Prepares the display $cache and a pre-existing $pane so that the pane configuration form for the $pane can be rendered.

Once form submission is completed, data is pushed back into js by panels_ajax_render().

Parameters

int $did: The display id of the display object currently being edited. Errors out silently if absent.

The pane id of the pane object whose configuration form we're calling up to edit.:

See also

panels_content_config_form()

1 string reference to 'panels_ajax_configure'
panels_menu in ./panels.module
Implementation of hook_menu

File

includes/display_edit.inc, line 937

Code

function panels_ajax_configure($did = NULL, $pid = NULL) {
  if ((is_numeric($did) || $did == 'new') && ($cache = panels_cache_get($did))) {
    if (isset($cache->display->content[$pid]) && ($pane = $cache->display->content[$pid])) {

      // Only perform on a form rendering passthrough and if the data hasn't already been built.
      if (!isset($_POST['form_id']) && empty($cc['built'])) {
        $cc =& $cache->content_config[$pane->pid];
        if (!isset($cc)) {
          list($cc['content_type'], $cc['content_subtype']) = array(
            $pane->type,
            $pane->subtype,
          );
          _panels_ajax_ct_preconfigure($cache, $pane);
          panels_cache_set($did, $cache);
        }
      }
      $ajax_vars = panels_ajax_form('panels_content_config_form', t('Configure !subtype_title', array(
        '!subtype_title' => $cache->content_config[$pane->pid]['ct_data']['subtype']['title'],
      )), url($_GET['q'], NULL, NULL, TRUE), $cache, $pane);
      panels_ajax_render($ajax_vars);
    }
  }
  panels_ajax_render();
}