function node_access_needs_rebuild
Same name and namespace in other branches
- 11.x core/modules/node/node.module \node_access_needs_rebuild()
- 10 core/modules/node/node.module \node_access_needs_rebuild()
- 9 core/modules/node/node.module \node_access_needs_rebuild()
- 8.9.x core/modules/node/node.module \node_access_needs_rebuild()
- 7.x modules/node/node.module \node_access_needs_rebuild()
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.
Parameters
bool|null $rebuild: (optional) The boolean value to be written. Defaults to NULL, which returns the current value.
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.
Deprecated
in drupal:11.4.0 and is removed from drupal:13.0.0. Use \Drupal::service('\Drupal\node\NodeAccessRebuild')->setNeedsRebuild() and \Drupal::service('\Drupal\node\NodeAccessRebuild')->needsRebuild() instead.
See also
https://www.drupal.org/node/3534610
File
-
core/
modules/ node/ node.module, line 162
Code
function node_access_needs_rebuild($rebuild = NULL) {
@trigger_error(__FUNCTION__ . '() is deprecated in drupal:11.4.0 and is removed from drupal:13.0.0. Use \\Drupal\\node\\NodeAccessRebuild instead. See https://www.drupal.org/node/3534610', E_USER_DEPRECATED);
/** @var \Drupal\node\NodeAccessRebuild $accessRebuild */
$accessRebuild = \Drupal::service(NodeAccessRebuild::class);
if (isset($rebuild)) {
$accessRebuild->setNeedsRebuild((bool) $rebuild);
return NULL;
}
return $accessRebuild->needsRebuild();
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.