You are here

function biblio_ui_contributor_create_form in Bibliography Module 7.3

Manage biblio contributor UI.

1 string reference to 'biblio_ui_contributor_create_form'
biblio_ui_menu in modules/biblio_ui/biblio_ui.module
Implements hook_menu().

File

modules/biblio_ui/biblio_ui.module, line 951
Main functionality file for the biblio UI module.

Code

function biblio_ui_contributor_create_form($form, &$form_state, BiblioContributor $contributor = NULL) {
  if (!$contributor) {
    $contributor = biblio_contributor_create();
  }
  $form_state['#entity'] = $contributor;
  $form['prefix'] = array(
    '#type' => 'textfield',
    '#title' => t('Prefix'),
    '#default_value' => $contributor->prefix,
  );
  $form['firstname'] = array(
    '#type' => 'textfield',
    '#title' => t('First name'),
    '#default_value' => $contributor->firstname,
  );
  $form['initials'] = array(
    '#type' => 'textfield',
    '#title' => t('Initials'),
    '#default_value' => $contributor->initials,
  );
  $form['lastname'] = array(
    '#type' => 'textfield',
    '#title' => t('Last name'),
    '#default_value' => $contributor->lastname,
  );
  $form['suffix'] = array(
    '#type' => 'textfield',
    '#title' => t('Suffix'),
    '#default_value' => $contributor->suffix,
  );
  if (!empty($contributor->name)) {
    $form['name'] = array(
      '#type' => 'textfield',
      '#title' => t('Full name'),
      '#default_value' => $contributor->name,
      '#disabled' => TRUE,
    );
  }
  $form['publisher'] = array(
    '#type' => 'textfield',
    '#title' => t('Existing user'),
    '#maxlength' => 60,
    '#autocomplete_path' => 'user/autocomplete',
    '#default_value' => !empty($contributor->uid) ? user_load($contributor->uid)->name : '',
  );
  $form['additional_settings'] = array(
    '#type' => 'vertical_tabs',
    '#weight' => 99,
  );
  $form['published'] = array(
    '#type' => 'fieldset',
    '#title' => t('Published'),
    '#collapsible' => TRUE,
    '#collapsed' => TRUE,
    '#group' => 'additional_settings',
    '#weight' => 100,
  );
  $timestamp_property = empty($contributor->is_new) ? 'changed' : 'created';
  $form['published']['created'] = array(
    '#type' => 'textfield',
    '#date_format' => 'Y-m-d G:i',
    '#title' => t('Published time'),
    '#default_value' => date('Y-m-d H:i', $contributor->{$timestamp_property}),
  );
  $form['actions'] = array(
    '#type' => 'actions',
    'submit' => array(
      '#type' => 'submit',
      '#value' => t('Save'),
    ),
    'cancel' => array(
      '#markup' => l(t('Cancel'), 'biblio-contributor'),
    ),
  );
  return $form;
}