function book_access_form_alter in Book access 5
Same name and namespace in other branches
- 6.2 book_access.module \book_access_form_alter()
- 6 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().
File
- ./
book_access.module, line 137 - Allows access control for Drupal book nodes.
Code
function book_access_form_alter($form_id, &$form) {
if ($form_id == 'book_node_form' && isset($form['parent'])) {
_book_access_restrict_options($form['parent']['#options']);
}
// When an outline is modified, taxonomy is changed, but the node is not
// saved, so node grants can become broken if a book page is moved into
// another book. so we fix that by adding an additional #submit callback
// that rebuilds the grants when the book outline is modified.
if ($form_id == 'book_outline_form') {
$form['#submit'][] = '_book_access_build_node_grants';
}
}