function panels_choose_layout in Panels 5.2
Same name and namespace in other branches
- 6.3 includes/display-layout.inc \panels_choose_layout()
- 6.2 includes/display-layout.inc \panels_choose_layout()
- 7.3 includes/display-layout.inc \panels_choose_layout()
Form definition for the display layout editor.
1 string reference to 'panels_choose_layout'
- _panels_edit_layout in includes/
display_edit.inc - Handle calling and processing of the form for editing display layouts.
File
- includes/
display_edit.inc, line 296
Code
function panels_choose_layout($display, $finish, $destination, $allowed_layouts) {
$layouts = array();
$available_layouts = panels_get_layouts();
foreach ($available_layouts as $layout_key => $layout_settings) {
if (!empty($allowed_layouts[$layout_key])) {
$layouts[$layout_key] = $layout_settings;
}
}
foreach ($layouts as $id => $layout) {
$options[$id] = panels_print_layout_icon($id, $layout, check_plain($layout['title']));
}
drupal_add_js(panels_get_path('js/layout.js'));
$form['layout'] = array(
'#type' => 'radios',
'#title' => t('Choose layout'),
'#options' => $options,
'#default_value' => in_array($display->layout, array_keys($layouts)) ? $display->layout : NULL,
'#attributes' => array(
'class' => 'clear-block',
),
);
$form['variables'] = array(
'#type' => 'value',
'#value' => array(
$display,
$finish,
$destination,
),
);
if (empty($destination)) {
$form['#redirect'] = FALSE;
}
if ($_POST['op'] && $_POST['op'] != t('Back') && $display->content) {
$form['#post'] = $_POST;
$form = form_builder('panels_choose_layout', $form);
unset($form['#post']);
$form['layout']['#type'] = 'hidden';
panels_change_layout($form, $display, $form['layout']['#value']);
}
if ($_POST['op'] && $_POST['op'] != t('Back') || !$display->content) {
$form['submit'] = array(
'#type' => 'submit',
'#value' => $finish,
);
}
else {
$form['submit'] = array(
'#type' => 'submit',
'#value' => t('Next'),
);
}
// no token please
$form['#token'] = FALSE;
return $form;
}