function biblio_hide_form_fields in Bibliography Module 7.2
1 call to biblio_hide_form_fields()
- biblio_form in ./
biblio.module - Displays the Add/Edit form for a biblio entity
File
- ./
biblio.module, line 1521
Code
function biblio_hide_form_fields(&$form, &$form_state) {
module_load_include('inc', 'biblio', 'includes/biblio.contributors');
$elements_to_hide = array();
$biblio = isset($form_state['biblio']) ? $form_state['biblio'] : FALSE;
if ($biblio) {
$instances = field_info_instances('biblio', $biblio->publication_type);
// Hide all entity reference widgets, so we can make use of the default biblio
// contributor widget
foreach (biblio_contributor_categories() as $category => $info) {
$vtab = $instances[$info['field']]['settings']['vtab'];
$elements_to_hide[$vtab][] = $info['field'];
}
}
// Set all containers of form fields we want to hide, to hidden
foreach ($elements_to_hide as $vtab => $fields) {
foreach ($fields as $field) {
// Fields with a biblio vtab set
if (isset($form['biblio_tabs'][$vtab][$field])) {
$form['biblio_tabs'][$vtab][$field]['#type'] = 'hidden';
}
else {
if (isset($form[$field])) {
$form[$field]['#type'] = 'hidden';
}
}
}
}
}