You are here

function theme_finder_admin_edit_elements_table in Finder 7

Same name and namespace in other branches
  1. 6 includes/finder.inc \theme_finder_admin_edit_elements_table()
  2. 6 includes/finder.theme.inc \theme_finder_admin_edit_elements_table()

Theme the admin table of draggable elements.

Parameters

$variables['form']: The form element to theme.

1 theme call to theme_finder_admin_edit_elements_table()
finder_admin_edit in includes/finder.admin.inc
Admin finder edit page.

File

includes/finder.theme.inc, line 15
Theme functions for the finder module.

Code

function theme_finder_admin_edit_elements_table($variables) {
  $form = $variables['form'];
  $children = element_children($form);
  if (!empty($children)) {
    $css_id = 'finder-admin-edit-elements-table';
    $css_class = 'finder-admin-edit-elements-table-order';
    drupal_add_tabledrag($css_id, 'order', 'sibling', $css_class);
    $rows = array();
    $headers = array(
      t('Element'),
      //t('Weight'),
      t('Operations'),
    );
    foreach ((array) $children as $key) {
      $value =& $form[$key];
      $value['weight']['#attributes']['class'][] = $css_class;
      $rows[] = array(
        'data' => array(
          drupal_render($value['value']),
          //drupal_render($value['weight']),
          drupal_render($value['ops']),
        ),
        'class' => array(
          'draggable',
        ),
      );
    }
    $output = theme('table', array(
      'header' => $headers,
      'rows' => $rows,
      'attributes' => array(
        'id' => $css_id,
      ),
    ));
  }
  else {
    $output = t('There are no items to display');
  }
  return $output;
}