You are here

function panels_ajax_add_pane_choose in Panels 6.2

Entry point for AJAX: 'Add Content' modal form, from which the user selects the type of pane to add.

Parameters

int $did: The display id of the $display object currently being edited.

string $panel_id: A string with the name of the panel region to which the selected pane type will be added.

Related topics

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

File

includes/display-edit.inc, line 333

Code

function panels_ajax_add_pane_choose($did = NULL, $panel_id = NULL) {
  panels_load_include('plugins');
  panels_load_include('ajax');
  $output = new stdClass();
  if ((is_numeric($did) || $did == 'new') && ($cache = panels_cache_get('display', $did))) {
    $display = $cache->display;
    $layout = panels_get_layout($display->layout);
    $layout_panels = panels_get_panels($layout, $display);
    if ($layout && array_key_exists($panel_id, $layout_panels)) {
      $output->output = panels_add_content($cache, $panel_id);
      $output->type = 'display';
      $output->title = t('Add content to !s', array(
        '!s' => $layout_panels[$panel_id],
      ));
    }
  }
  panels_ajax_render($output);
}