You are here

function panels_edit_display_form_submit in Panels 7.3

Same name and namespace in other branches
  1. 6.3 includes/display-edit.inc \panels_edit_display_form_submit()
  2. 6.2 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.

3 calls to panels_edit_display_form_submit()
panels_mini_ui::edit_form_content_submit in panels_mini/plugins/export_ui/panels_mini_ui.class.php
panels_page_wizard_add_content_submit in includes/page-wizard.inc
Add content form submit handler.
panels_panel_context_edit_content_submit in plugins/task_handlers/panel_context.inc
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_ipe_edit_control_form in panels_ipe/plugins/display_renderers/panels_renderer_ipe.class.php
FAPI callback to create the Save/Cancel form for the IPE.

File

includes/display-edit.inc, line 150
Core Panels API include file containing various display-editing functions. This includes all the basic editing forms (content, layout, layout settings) as well as the ajax modal forms associated with them.

Code

function panels_edit_display_form_submit($form, &$form_state) {
  $display =& $form_state['display'];
  $old_content = $display->content;
  $display->content = array();
  if (!empty($form_state['values']['panel']['pane'])) {
    foreach ($form_state['values']['panel']['pane'] as $region_id => $panes) {
      $display->panels[$region_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[$region_id][] = $pid;
            $old_content[$pid]->panel = $region_id;
            $display->content[$pid] = $old_content[$pid];

            // If the panel has region locking, make sure that the region
            // the panel is in is applicable. This can happen if the panel
            // was moved and then the lock changed and the server didn't
            // know.
            if (!empty($old_content[$pid]->locks) && $old_content[$pid]->locks['type'] == 'regions') {
              $old_content[$pid]->locks['regions'][$region_id] = $region_id;
            }
          }
        }
      }
    }
  }
  panels_edit_display_settings_form_submit($form, $form_state);
}