function book_access_form_alter in Book access 6
Same name and namespace in other branches
- 5 book_access.module \book_access_form_alter()
- 6.2 book_access.module \book_access_form_alter()
- 7.2 book_access.module \book_access_form_alter()
- 1.x book_access.module \book_access_form_alter()
Implements hook_form_alter().
See also
book_access_outline_form_submit()
book_access_edit_form_submit()
File
- ./
book_access.module, line 19 - Allows access control for book nodes on a per book basis. It is based on forum_access.module and tac_lite.module.
Code
function book_access_form_alter(&$form, &$form_state, $form_id) {
if (isset($form['type']) && isset($form['#node']) && $form['type']['#value'] . '_node_form' == $form_id) {
if (isset($form['book']['bid']['#options'])) {
_book_access_options_restrict($form['book']['bid']['#options']);
}
$form['#submit'][] = 'book_access_edit_form_submit';
}
elseif ($form_id == 'book_outline_form') {
if (isset($form['book']['bid']['#options'])) {
_book_access_options_restrict($form['book']['bid']['#options']);
}
$form['#submit'][] = 'book_access_outline_form_submit';
if (isset($form['remove'])) {
$form['remove']['#submit'][] = 'book_access_edit_form_submit';
}
}
}