/Drupal 8

function node_access_needs_rebuild

node_access_needs_rebuild($rebuild = NULL)

Toggles or reads the value of a flag for rebuilding the node access grants.

When the flag is set, a message is displayed to users with 'access administration pages' permission, pointing to the 'rebuild' confirm form. This can be used as an alternative to direct node_access_rebuild calls, allowing administrators to decide when they want to perform the actual (possibly time consuming) rebuild.

When unsure if the current user is an administrator, node_access_rebuild() should be used instead.


$rebuild: (optional) The boolean value to be written.

Return value

bool|null The current value of the flag if no value was provided for $rebuild. If a value was provided for $rebuild, nothing (NULL) is returned.

See also


Related topics

Node access rights
The node access system determines who can do what to which nodes.


core/modules/node/node.module, line 1110
The core module that allows content to be submitted to the site.


function node_access_needs_rebuild($rebuild = NULL) {
  if (!isset($rebuild)) {
    return \Drupal::state()->get('node.node_access_needs_rebuild') ? : FALSE;
  elseif ($rebuild) {
    \Drupal::state()->set('node.node_access_needs_rebuild', TRUE);
  else {

© 2001–2016 by the original authors
Licensed under the GNU General Public License, version 2 and later.
Drupal is a registered trademark of Dries Buytaert.