public function QuickNodeCloneNodeAccess::cloneNode in Quick Node Clone 8
Limit access to the clone according to their restricted state.
Parameters
\Drupal\Core\Session\AccountInterface $account: The account object.
int $node: The node id.
Return value
\Drupal\Core\Access\AccessResultAllowed|\Drupal\Core\Access\AccessResultForbidden If allowed, AccessResultAllowed isAllowed() will be TRUE. If forbidden, isForbidden() will be TRUE.
1 string reference to 'QuickNodeCloneNodeAccess::cloneNode'
File
- src/
Controller/ QuickNodeCloneNodeAccess.php, line 26
Class
- QuickNodeCloneNodeAccess
- Access control for cloning nodes.
Namespace
Drupal\quick_node_clone\ControllerCode
public function cloneNode(AccountInterface $account, $node) {
$node = Node::load($node);
if (_quick_node_clone_has_clone_permission($node)) {
$result = AccessResult::allowed();
}
else {
$result = AccessResult::forbidden();
}
$result
->addCacheableDependency($node);
return $result;
}