function biblio_bibtex_form_biblio_node_form_alter in Bibliography Module 6.2
Same name and namespace in other branches
- 7 modules/bibtexParse/biblio_bibtex.module \biblio_bibtex_form_biblio_node_form_alter()
File
- modules/
bibtexParse/ biblio_bibtex.module, line 45
Code
function biblio_bibtex_form_biblio_node_form_alter(&$form, &$form_state) {
global $user;
if (phpversion() > 5 && !$form_state['submitted'] && !isset($form['#node']->nid)) {
// this will be empty if pub type has not been selected from the dropdown (put this in for node_clone)
if (!$form_state['submitted']) {
$form['biblio_cut_paste'] = array(
'#type' => 'fieldset',
'#title' => t('Paste BibTex'),
'#weight' => -20,
'#collapsible' => TRUE,
'#collapsed' => TRUE,
);
$form['biblio_cut_paste']['paste_data_bibtex'] = array(
'#type' => 'textarea',
'#title' => t('BibTex'),
'#required' => FALSE,
'#default_value' => $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'),
);
}
$form['#validate'] = array_merge(array(
'biblio_bibtex_form_biblio_node_form_validate',
), $form['#validate']);
// put my validator first
}
$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,
);
}