You are here

function _biblio_contributor_form in Bibliography Module 6.2

Same name and namespace in other branches
  1. 6 biblio.module \_biblio_contributor_form()

Creates contributor form elements for contributor widget and JSON callback.

Parameters

$delta:

string $author_category:

array $values:

array $types: (optional)

bool $autocomplete: (optional) A logical flag indicating whether ... The default value is TRUE.

Return value

array $form An associative array of form definition elements.

2 calls to _biblio_contributor_form()
biblio_contributors_js in ./biblio.module
Prepares a JSON response for the contributor widget.
_biblio_contributor_widget in ./biblio.module
Defines a contributor widget to be used as part of biblio node form.

File

./biblio.module, line 1648
Main file for Drupal module biblio.

Code

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

  // 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['md5'] = array(
    '#type' => 'hidden',
    '#default_value' => $values['md5'],
    '#parents' => array(
      'biblio_contributors',
      $auth_category,
      $delta,
      'md5',
    ),
  );
  $form['rank'] = array(
    '#type' => 'textfield',
    '#size' => 6,
    '#default_value' => $values['rank'],
    '#parents' => array(
      'biblio_contributors',
      $auth_category,
      $delta,
      'rank',
    ),
  );
  return $form;
}