You are here

function biblio_contributor_biblio_form in Bibliography Module 7.2

Set up the form for ONE contributor in the biblio add/edit form.

Parameters

object $contributor:

array $form_state:

integer $delta The iterative value of the current contributor. 0,1,2...etc.:

Return value

string

1 call to biblio_contributor_biblio_form()
biblio_contributor_widget in ./biblio.module
Get form structure for the multivalued add contributor widget

File

./biblio.module, line 1447

Code

function biblio_contributor_biblio_form($contributor, $biblio, &$form_state) {
  module_load_include('inc', 'biblio', 'includes/biblio.contributors');
  foreach (biblio_contributor_categories($biblio->publication_type) as $category => $info) {
    $category_options[$category] = $info['label'];
  }
  $form = array(
    '#tree' => TRUE,
  );
  $form['name'] = array(
    '#type' => 'textfield',
    '#autocomplete_path' => 'biblio/autocomplete/contributor',
    '#default_value' => isset($contributor['name']) ? $contributor['name'] : '',
  );
  $form['category'] = array(
    '#type' => 'select',
    '#default_value' => isset($contributor['category']) ? $contributor['category'] : '',
    '#options' => $category_options,
    '#multiple' => FALSE,
  );
  $form['cid'] = array(
    '#type' => 'hidden',
    '#default_value' => isset($contributor['cid']) ? $contributor['cid'] : '',
  );
  $form['rank'] = array(
    '#type' => 'textfield',
    '#size' => 6,
    '#default_value' => isset($contributor['rank']) ? $contributor['rank'] : '',
  );

  // Get the language of the name field
  // $lang = $form['biblio_contributor_name']['#language'];
  // Set up autocomplete for the Name field
  // $form['biblio_contributor_name'][$lang][0]['value']['#autocomplete_path']
  // = 'biblio/autocomplete/contributor';
  // Set the form's parents so FAPI can distinguish between the multiple Name fields
  // $form['#parents'] = array(
  //   'biblio_tabs',
  //   1,
  //   'biblio_contributors',
  //   $delta,
  //   'biblio_contributor_name'
  // );
  // // Remove the title above each field
  // $form['biblio_contributor_name'][$lang][0]['value']['#title'] = '';
  // // Reset the language to the language set for biblio_contributor_category field
  // $lang = $form['biblio_contributor_category']['#language'];
  // // Remove the "- None -" option from the select list
  // unset($form['biblio_contributor_category'][$lang]['#options']['_none']);
  // // Remove the title above each field
  // $form['biblio_contributor_category'][$lang]['#title'] = '';
  return $form;
}