function _panels_edit_layout in Panels 5.2
Same name and namespace in other branches
- 6.3 includes/display-layout.inc \_panels_edit_layout()
- 6.2 includes/display-layout.inc \_panels_edit_layout()
- 7.3 includes/display-layout.inc \_panels_edit_layout()
Handle calling and processing of the form for editing display layouts.
Helper function for panels_edit_layout().
See also
panels_edit_layout() for details on the various behaviors of this function.
1 call to _panels_edit_layout()
- panels_edit_layout in ./
panels.module - API entry point for selecting a layout for a given display.
File
- includes/
display_edit.inc, line 260
Code
function _panels_edit_layout($display, $finish, $destination, $allowed_layouts) {
panels_load_include('common');
// module_name has been provided; the data was saved by the api_save() method.
if (is_string($allowed_layouts)) {
$allowed_layouts = unserialize(variable_get($allowed_layouts . "_allowed_layouts", serialize('')));
}
// if no parameter was provided, or the variable_get failed
if (!$allowed_layouts) {
// tries to load the common panels allowed layouts
$allowed_layouts = unserialize(variable_get('panels_common_allowed_layouts', serialize('')));
if (!$allowed_layouts) {
// still no dice. simply creates a dummy version where all layouts are allowed.
$allowed_layouts = new panels_allowed_layouts();
$allowed_layouts->allow_new = TRUE;
}
}
// sanitize allowed layout listing; this is redundant if the $allowed_layouts param was null, but the data is cached anyway
$allowed_layouts
->sync_with_available();
// Break out the form pieces so we can return the new $display upon
// successful submit.
$form_id = 'panels_choose_layout';
$form = drupal_retrieve_form($form_id, $display, $finish, $destination, array_filter($allowed_layouts->allowed_layout_settings));
if ($result = drupal_process_form($form_id, $form)) {
// successful submit
return $result;
}
$output = drupal_render_form($form_id, $form);
return $output;
}