function panels_choose_layout_submit in Panels 5.2
Same name and namespace in other branches
- 6.3 includes/display-layout.inc \panels_choose_layout_submit()
- 6.2 includes/display-layout.inc \panels_choose_layout_submit()
- 7.3 includes/display-layout.inc \panels_choose_layout_submit()
Handle form submission of the display layout editor.
The behavior of this function is fairly complex and irregular compared to most FAPI submit handlers. See the documentation on panels_edit_layout() for detailed discussion of this behavior.
File
- includes/
display_edit.inc, line 359
Code
function panels_choose_layout_submit($form_id, $form_values) {
list($display, $finish, $destination) = $form_values['variables'];
$new_layout_id = $form_values['layout'];
if ($form_values['op'] == $finish) {
if (!empty($form_values['old'])) {
foreach ($form_values['old'] as $id => $new_id) {
$content[$new_id] = array_merge((array) $content[$new_id], $display->panels[$id]);
foreach ($content[$new_id] as $pid) {
$display->content[$pid]->panel = $new_id;
}
}
$display->panels = $content;
}
$display->layout = $new_layout_id;
// save it back to our session.
panels_save_display($display);
if (empty($destination)) {
return $display;
}
return $destination;
}
return FALSE;
}