You are here

function _panels_edit in Panels 5.2

Same name and namespace in other branches
  1. 6.3 includes/display-edit.inc \_panels_edit()
  2. 6.2 includes/display-edit.inc \_panels_edit()
  3. 7.3 includes/display-edit.inc \_panels_edit()

Handle calling and processing of the form for editing display content.

Helper function for panels_edit().

See also

panels_edit() for details on the various behaviors of this function.

1 call to _panels_edit()
panels_edit in ./panels.module
Main API entry point to edit a panel display.

File

includes/display_edit.inc, line 18

Code

function _panels_edit($display, $destination, $content_types) {
  $did = $display->did;
  if (!$did) {
    $display->did = $did = 'new';
  }

  // Load the display being edited from cache, if possible.
  if (!empty($_POST) && is_object($cache = panels_cache_get($did))) {
    $display = $cache->display;
  }
  else {
    panels_cache_clear($did);
    $cache = new stdClass();
    $cache->display = $display;
    $cache->content_types = $content_types;
    panels_cache_set($did, $cache);
  }

  // Break out the form pieces so we can return the new $display upon
  // successful submit.
  $form_id = 'panels_edit_display';
  $form = drupal_retrieve_form($form_id, $display, $destination);
  if ($result = drupal_process_form($form_id, $form)) {

    // successful submit
    return $result;
  }
  $output = drupal_render_form($form_id, $form);
  $output .= theme('panels_hidden');
  return $output;
}