You are here

function theme_biblio_field_tab in Bibliography Module 7

Same name and namespace in other branches
  1. 7.2 includes/biblio.theme.inc \theme_biblio_field_tab()
1 theme call to theme_biblio_field_tab()
biblio_admin_types_edit_form in includes/biblio.admin.inc
Form constructor for the Publication type edit form.

File

includes/biblio_theme.inc, line 929

Code

function theme_biblio_field_tab($variables) {
  $form = $variables['form'];
  $rows = array();
  $headers = $form['#header'];
  drupal_add_tabledrag($form['#id'], 'order', 'sibling', 'weight');
  foreach (element_children($form['rows']) as $key) {

    // No need to print the field title every time.
    //    unset($form[$key]['name']['#title'], $form[$key]['auth_type']['#title'], $form[$key]['auth_category']['#title']);
    // Add class to group weight fields for drag and drop.
    $form['rows'][$key]['weight']['#attributes']['class'] = array(
      'weight',
    );

    // Build the table row.
    $row = array(
      '',
    );
    $row[] = array(
      'data' => drupal_render($form['rows'][$key]['name']),
    );
    $row[] = array(
      'data' => drupal_render($form['rows'][$key]['title']),
    );
    $row[] = array(
      'data' => drupal_render($form['rows'][$key]['hint']),
    );
    foreach (element_children($form['rows'][$key]['checkboxes']) as $oid) {
      if (is_array($form['rows'][$key]['checkboxes'])) {
        $row[] = array(
          'data' => drupal_render($form['rows'][$key]['checkboxes'][$oid]),
          'title' => $oid,
        );
      }
    }
    $row[] = drupal_render($form['rows'][$key]['weight']);
    $rows[] = array(
      'data' => $row,
      'class' => array(
        'draggable',
      ),
    );
  }
  $output = theme('table', array(
    'header' => $headers,
    'rows' => $rows,
    'attributes' => array(
      'id' => $form['#id'],
    ),
  ));
  $output .= drupal_render_children($form);
  return $output;
}