function theme_page_manager_handler_rearrange

Turn the rearrange form into a table with tablesorting on.

File

page_manager/theme/page_manager.theme.inc, line 50

Code

function theme_page_manager_handler_rearrange($vars) {
    $form =& $vars['form'];
    // Assemble the data for a table from everything in $form['handlers'].
    foreach (element_children($form['handlers']) as $id) {
        // Provide a reference shortcut.
        $element =& $form['handlers'][$id];
        if (isset($element['title'])) {
            $row = array();
            $row[] = array(
                'data' => render($element['title']),
                'class' => array(
                    'page-manager-handler',
                ),
            );
            $element['weight']['#attributes']['class'][] = 'weight';
            $row[] = render($element['weight']);
            $rows[] = array(
                'data' => $row,
                'class' => array(
                    'draggable',
                ),
                'id' => 'page-manager-row-' . $id,
            );
        }
    }
    if (empty($rows)) {
        $rows[] = array(
            array(
                'data' => t('No task handlers are defined for this task.'),
                'colspan' => '5',
            ),
        );
    }
    $header = array(
        array(
            'data' => t('Variant'),
            'class' => array(
                'page-manager-handler',
            ),
        ),
        t('Weight'),
    );
    drupal_add_tabledrag('page-manager-arrange-handlers', 'order', 'sibling', 'weight');
    $output = theme('table', array(
        'header' => $header,
        'rows' => $rows,
        'attributes' => array(
            'id' => 'page-manager-arrange-handlers',
        ),
    ));
    $output .= drupal_render_children($form);
    return $output;
}