Disable outline information on node types not enabled for book outlines
This commit is contained in:
parent
8bc400de2a
commit
07fc14091e
2 changed files with 15 additions and 2 deletions
|
@ -149,7 +149,10 @@ function book_menu() {
|
|||
* Menu item access callback - determine if the outline tab is accessible.
|
||||
*/
|
||||
function _book_outline_access($node) {
|
||||
return user_access('administer book outlines') && node_access('view', $node);
|
||||
// Patch http://drupal.org/node/502430:
|
||||
$restrict = variable_get('book_restrict_to_types', false);
|
||||
$types = variable_get('book_allowed_types', array('book'));
|
||||
return (user_access('administer book outlines') && ((in_array($node->type, $types)) || (!$restrict))) && node_access('update', $node);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -286,7 +289,8 @@ function book_form_alter(&$form, $form_state, $form_id) {
|
|||
// Add elements to the node form
|
||||
$node = $form['#node'];
|
||||
|
||||
$access = user_access('administer book outlines');
|
||||
// Patch http://drupal.org/node/502430:
|
||||
$access = _book_outline_access($node);
|
||||
if (!$access) {
|
||||
if (user_access('add content to books') && ((!empty($node->book['mlid']) && !empty($node->nid)) || book_type_is_allowed($node->type))) {
|
||||
// Already in the book hierarchy or this node type is allowed
|
||||
|
|
Reference in a new issue