You are here

function _biblio_contributor_form in Bibliography Module 6

Same name and namespace in other branches
  1. 6.2 biblio.module \_biblio_contributor_form()
2 calls to _biblio_contributor_form()
biblio_contributors_js in ./biblio.module
_biblio_contributor_widget in ./biblio.module

File

./biblio.module, line 1487

Code

function _biblio_contributor_form($delta, $auth_category, $values, $types = NULL, $autocomplete = TRUE) {
  $form = array(
    '#tree' => TRUE,
  );

  // We'll manually set the #parents property of these fields so that
  // their values appear in the $form_state['values']['choice'] array.
  $form['name'] = array(
    '#type' => 'textfield',
    '#title' => t('Name'),
    '#autocomplete_path' => $autocomplete ? 'biblio/autocomplete/contributor' : '',
    '#default_value' => $values['name'],
    '#parents' => array(
      'biblio_contributors',
      $auth_category,
      $delta,
      'name',
    ),
  );
  if (count($types) > 1) {
    $form['auth_type'] = array(
      '#type' => 'select',
      '#title' => t('Type'),
      '#default_value' => $values['auth_type'],
      '#options' => $types,
      '#multiple' => FALSE,
      '#parents' => array(
        'biblio_contributors',
        $auth_category,
        $delta,
        'auth_type',
      ),
    );
  }
  else {
    $form['auth_type'] = array(
      '#type' => 'hidden',
      '#value' => $values['auth_type'],
      '#parents' => array(
        'biblio_contributors',
        $auth_category,
        $delta,
        'auth_type',
      ),
    );
  }
  $form['cid'] = array(
    '#type' => 'hidden',
    '#default_value' => $values['cid'],
    '#parents' => array(
      'biblio_contributors',
      $auth_category,
      $delta,
      'cid',
    ),
  );
  $form['rank'] = array(
    '#type' => 'textfield',
    '#size' => 6,
    '#default_value' => $values['rank'],
    '#parents' => array(
      'biblio_contributors',
      $auth_category,
      $delta,
      'rank',
    ),
  );
  return $form;
}