function hs_book_form_alter in Hierarchical Select 5.3
Implementation of hook_form_alter().
File
- modules/
hs_book.module, line 34 - Implementation of the Hierarchical Select API for the Book module.
Code
function hs_book_form_alter($form_id, &$form) {
if ($form_id == 'book_node_form' && isset($form['parent'])) {
unset($form['parent']['#options']);
$form['parent']['#type'] = 'hierarchical_select';
$form['parent']['#config'] = array(
'module' => 'hs_book',
'params' => array(
'nid' => isset($form['nid']) ? $form['nid']['#value'] : NULL,
),
'save_lineage' => 0,
'enforce_deepest' => 0,
'resizable' => variable_get('hs_book_resizable', 1),
);
$form['parent']['#default_value'] = !is_numeric($form['parent']['#default_value']) ? 0 : $form['parent']['#default_value'];
}
}