You are here

function biblio_bibtex_form_biblio_form_alter in Bibliography Module 7.2

Implements hook_form_FORM_ID_alter @global type $user

_state

Parameters

type $form:

File

modules/bibtexParse/biblio_bibtex.module, line 35

Code

function biblio_bibtex_form_biblio_form_alter(&$form, &$form_state) {
  global $user;
  if (!$form_state['submitted'] && !isset($form_state['values']) && !isset($form_state['biblio']->bid)) {
    if (!$form_state['submitted']) {
      $form['biblio_cut_paste'] = array(
        '#type' => 'fieldset',
        '#title' => t('Paste BibTex Record'),
        '#weight' => -20,
        '#collapsible' => TRUE,
        '#collapsed' => TRUE,
      );
      $form['biblio_cut_paste']['paste_data_bibtex'] = array(
        '#type' => 'textarea',
        '#title' => t('BibTex'),
        '#required' => FALSE,
        '#default_value' => isset($form_state['values']['paste_data_bibtex']) ? $form_state['values']['paste_data_bibtex'] : '',
        '#description' => t('Paste a BibTex entry here'),
        '#size' => 60,
        '#weight' => -4,
      );
      $form['biblio_cut_paste']['paste_submit'] = array(
        '#type' => 'submit',
        '#value' => t('Populate using BibTex'),
        '#submit' => array(
          'biblio_bibtex_form_biblio_form_submit',
        ),
      );
    }
  }
  $biblio_bibtex_id = isset($form_state['values']['biblio_bibtex_id']) ? $form_state['values']['biblio_bibtex_id'] : '';
  $biblio_bibtex_md5 = isset($form_state['values']['biblio_bibtex_md5']) ? $form_state['values']['biblio_bibtex_md5'] : '';
  $form['biblio_bibtex_id'] = array(
    '#type' => 'value',
    '#value' => $biblio_bibtex_id,
  );
  $form['biblio_bibtex_md5'] = array(
    '#type' => 'value',
    '#value' => $biblio_bibtex_md5,
  );
}