You are here

function theme_linkit_profiles_reorder in Linkit 7.2

Preprocess tabledrag

Parameters

$variables: An associative array containing:

  • form: A render element representing the form.

File

./linkit.theme.inc, line 73
Linkit theme functions.

Code

function theme_linkit_profiles_reorder($variables) {
  $form = $variables['form'];
  $header = array(
    t('Profile'),
    t('Roles'),
    t('Weight'),
  );
  $rows = array();
  if (isset($form['profiles'])) {
    foreach (element_children($form['profiles']) as $profile_name) {
      $rows[] = array(
        'data' => array(
          drupal_render($form['profiles'][$profile_name]['name']),
          drupal_render($form['profiles'][$profile_name]['roles']),
          drupal_render($form['profiles'][$profile_name]['weight']),
        ),
        'class' => array(
          'draggable',
          'tabledrag-leaf',
        ),
      );
    }
  }
  $output = theme('table', array(
    'header' => $header,
    'rows' => $rows,
    'attributes' => array(
      'id' => 'linkit-profile-reorder',
    ),
    'sticky' => FALSE,
  ));
  $output .= drupal_render_children($form);
  drupal_add_tabledrag('linkit-profile-reorder', 'order', 'sibling', 'weight', NULL, NULL, FALSE);
  return $output;
}