You are here

function theme_biblio_contributors in Bibliography Module 6

Same name and namespace in other branches
  1. 6.2 includes/biblio_theme.inc \theme_biblio_contributors()
  2. 7 includes/biblio_theme.inc \theme_biblio_contributors()
  3. 7.2 includes/biblio.theme.inc \theme_biblio_contributors()

Parameters

$form:

Return value

unknown_type

1 theme call to theme_biblio_contributors()
_biblio_contributor_widget in ./biblio.module

File

./biblio_theme.inc, line 1047

Code

function theme_biblio_contributors($form) {
  $rows = array();
  if ($form['#hideRole']) {
    $headers = array(
      '',
      t('Name'),
      t('Weight'),
    );
  }
  else {
    $headers = array(
      '',
      t('Name'),
      t('Role'),
      t('Weight'),
    );
  }
  drupal_add_tabledrag($form['#id'], 'order', 'sibling', 'rank');
  foreach (element_children($form) as $key) {

    // No need to print the field title every time.
    unset($form[$key]['name']['#title'], $form[$key]['auth_type']['#title']);

    // Add class to group weight fields for drag and drop.
    $form[$key]['rank']['#attributes']['class'] = 'rank';

    // Build the table row.
    $row = array(
      '',
    );
    $row[] = array(
      'data' => drupal_render($form[$key]['name']),
      'class' => 'biblio-contributor',
    );
    if (!$form['#hideRole']) {
      $row[] = array(
        'data' => drupal_render($form[$key]['auth_type']),
        'class' => 'biblio-contributor-type',
      );
    }
    $row[] = drupal_render($form[$key]['rank']);
    $rows[] = array(
      'data' => $row,
      'class' => 'draggable',
    );
  }
  $output = theme('table', $headers, $rows, array(
    'id' => $form['#id'],
  ));
  $output .= drupal_render($form);
  return $output;
}