1 layout.theme.inc | theme_layout_reorder_layouts($variables) |
Turn the rearrange form into a table with table sorting displayed.
File
- core/
modules/ layout/ layout.theme.inc, line 10 - Theme functions for the Layout module.
Code
function theme_layout_reorder_layouts($variables) {
$element = $variables['element'];
$rows = array();
// Assemble the data for a table from everything in $form['handlers']
foreach (element_children($element) as $layout_name) {
if (isset($element[$layout_name]['title'])) {
$row = array();
$row[] = array(
'data' => render($element[$layout_name]['title']),
'class' => array('layout-name'),
);
$element[$layout_name]['weight']['#attributes']['class'][] = 'weight';
$row[] = render($element[$layout_name]['weight']);
$rows[] = array('data' => $row, 'class' => array('draggable'));
}
}
$header = array(
array('data' => t('Layout'), 'class' => array('layout-name')),
t('Weight'),
);
backdrop_add_tabledrag('layout-reorder', 'order', 'sibling', 'weight');
$output = theme('table', array('header' => $header, 'rows' => $rows, 'attributes' => array('id' => 'layout-reorder')));
$output .= backdrop_render_children($element);
return $output;
}