public function NodeAuthlinkNodeForm::access in Node authorize link 8
Checks that node_authlink was enabled for this content type.
Parameters
\Drupal\Core\Session\AccountInterface $account:
$node:
Return value
\Drupal\Core\Access\AccessResultInterface
1 string reference to 'NodeAuthlinkNodeForm::access'
File
- src/
Form/ NodeAuthlinkNodeForm.php, line 229
Class
- NodeAuthlinkNodeForm
- Class NodeAuthlinkNodeForm.
Namespace
Drupal\node_authlink\FormCode
public function access(AccountInterface $account, $node) {
if (is_numeric($node)) {
$node = Node::load($node);
$enable = $this
->config('node_authlink.settings')
->get('enable');
if (isset($enable[$node
->bundle()]) && $enable[$node
->bundle()] && ($account
->hasPermission('create and delete node authlinks') || $account
->hasPermission(sprintf('create and delete node %s authlinks', $node
->bundle())))) {
return AccessResult::allowed();
}
}
return AccessResult::forbidden();
}