You are here

function panels_ajax_add_content in Panels 5.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.

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

File

includes/display_edit.inc, line 703

Code

function panels_ajax_add_content($did = NULL, $panel_id = NULL) {
  $output = new stdClass();
  if ((is_numeric($did) || $did == 'new') && ($cache = panels_cache_get($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);
}