function theme_panels_edit_form in Panels 5
Display the form to edit a panels.
File
- ./
panels.module, line 516
Code
function theme_panels_edit_form($form) {
$layouts = panels_get_layouts();
$layout = $layouts[$form['layout']['#value']];
$content_types = panels_get_content_types();
$output .= drupal_render($form['info']);
foreach ($layout['content areas'] as $area => $title) {
$order = unserialize($form['content'][$area]['order']['#value']);
if (!$order) {
$area_content = t('This area has no content.');
}
else {
$area_content = '';
$count = count($order);
foreach ($order as $position => $id) {
if ($count > 1) {
if ($position == 0) {
panels_set_blank($form['content'][$area][$id]['buttons']['up']);
}
else {
if ($position == $count - 1) {
panels_set_blank($form['content'][$area][$id]['buttons']['down']);
}
}
}
$type = $form['content'][$area][$id]['type']['#value'];
$function = $content_types[$type]['admin'];
if (function_exists($function)) {
// figure out the actual values; using the global because we need it
// to be in the same format it'll be in 'submit'.
global $form_values;
$conf_form = $form_values['content'][$area][$id]['configuration'];
$conf = $function('save', $conf_form);
$fieldset = array(
'#title' => t('Configure'),
'#children' => drupal_render($form['content'][$area][$id]['configuration']),
'#collapsible' => true,
'#collapsed' => true,
);
$buttons = drupal_render($form['content'][$area][$id]['buttons']);
$area_content .= $buttons . ' ' . $function('list', $conf) . theme('fieldset', $fieldset);
}
}
}
$content[$area] = theme('fieldset', array(
'#title' => check_plain($title),
'#value' => $area_content,
));
}
$output .= panels_get_layout($layout, $content);
$output .= drupal_render($form);
return $output;
}