public function NodeTabForm::checkAccess in Simplenews 8
Same name and namespace in other branches
- 8.2 src/Form/NodeTabForm.php \Drupal\simplenews\Form\NodeTabForm::checkAccess()
- 3.x src/Form/NodeTabForm.php \Drupal\simplenews\Form\NodeTabForm::checkAccess()
Checks access for the simplenews node tab.
Parameters
\Drupal\node\NodeInterface $node: The node where the tab should be added.
Return value
\Drupal\Core\Access\AccessResult An access result object.
1 string reference to 'NodeTabForm::checkAccess'
File
- src/
Form/ NodeTabForm.php, line 359
Class
- NodeTabForm
- Configure simplenews subscriptions of a user.
Namespace
Drupal\simplenews\FormCode
public function checkAccess(NodeInterface $node) {
$account = $this
->currentUser();
if ($node
->hasField('simplenews_issue') && $node->simplenews_issue->target_id != NULL) {
return AccessResult::allowedIfHasPermission($account, 'administer newsletters')
->orIf(AccessResult::allowedIfHasPermission($account, 'send newsletter'));
}
return AccessResult::neutral();
}