You are here

function panels_edit_display_form_submit in Panels 6.2

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

Handle form submission of the display content editor.

This reads the location of the various panes from the form, which will have been modified from the ajax, rearranges them and then saves the display.

2 string references to 'panels_edit_display_form_submit'
panels_edit_display_form in includes/display-edit.inc
Form definition for the panels display editor
panels_panel_node_view_delegator_task_handlers in plugins/task_handlers/panel_node_view.inc

File

includes/display-edit.inc, line 215

Code

function panels_edit_display_form_submit($form, &$form_state) {
  $display =& $form_state['display'];
  $old_content = $display->content;
  $display->content = array();
  foreach ($form_state['values']['panel']['pane'] as $panel_id => $panes) {
    $display->panels[$panel_id] = array();
    if ($panes) {
      $pids = explode(',', $panes);

      // need to filter the array, b/c passing it in a hidden field can generate trash
      foreach (array_filter($pids) as $pid) {
        if ($old_content[$pid]) {
          $display->panels[$panel_id][] = $pid;
          $old_content[$pid]->panel = $panel_id;
          $display->content[$pid] = $old_content[$pid];
        }
      }
    }
  }
}