You are here

function theme_quickbar_form in Quickbar 6

Same name and namespace in other branches
  1. 7.2 quickbar.admin.inc \theme_quickbar_form()
  2. 7 quickbar.admin.inc \theme_quickbar_form()

Theme handler for quickbar_form()

See also

theme_quickbar_form()

File

./quickbar.admin.inc, line 93
Handles quickbar administration

Code

function theme_quickbar_form($form) {
  $output = drupal_render($form['intro']);

  // Get the weighted list of roles and add roles that haven't been weighted yet
  $roles = unserialize(variable_get('quickbar_role_weights', ''));
  foreach (user_roles() as $rid => $name) {
    if (empty($roles[$rid])) {
      $roles[$rid] = 0;
    }
  }

  // Sort the roles.
  asort($roles);

  // Build the table rows.
  $rows = array();
  foreach ($roles as $rid => $name) {
    $rows[] = array(
      'data' => array(
        drupal_render($form['toolbar_title_' . $rid]),
        drupal_render($form['toolbar_' . $rid]),
        drupal_render($form['toolbar_configure_' . $rid]),
        drupal_render($form['toolbar_weight_' . $rid]),
      ),
      'class' => 'draggable',
    );
  }

  // Build our draggable table
  $header = array(
    t('Role'),
    t('Assigned Menu'),
    array(
      'data' => t('Configuration'),
      'colspan' => 2,
    ),
  );
  $output .= theme('table', $header, $rows, array(
    'id' => 'quickbar-role-order',
  ));
  $output .= drupal_render($form);
  drupal_add_tabledrag('quickbar-role-order', 'order', 'sibling', 'quickbar-role-order-weight');
  return $output;
}