public static function BookAccess::restrictOptions in Book access 6.2
Same name and namespace in other branches
- 7.2 book_access.module \BookAccess::restrictOptions()
Restricts the options available to who moves book pages between books.
Parameters
$options: The options array used from book_outline_form() and the book edit form for the list of books to which the page can be moved to.
$account: The user account to use; if NULL, the currently logged in user account will be used.
1 call to BookAccess::restrictOptions()
- book_access_form_alter in ./
book_access.module - Implements hook_form_alter().
File
- ./
book_access.module, line 505 - Allows to set the access control for book nodes on a per book basis. It is based on forum_access.module and tac_lite.module.
Class
- BookAccess
- @file
Code
public static function restrictOptions(&$options, $account = NULL) {
if (!isset($account)) {
$account = $GLOBALS['user'];
}
if (user_access('administer nodes', $account)) {
return;
}
$permitted_bids = self::getBookList(array(
'update',
), $account);
foreach ($options as $bid => $value) {
if ($bid > 0 && !isset($permitted_bids[$bid])) {
unset($options[$bid]);
}
}
}