You are here

public function TestMailForm::access in Sparkpost email 8.2

Access handler for the form.

Requires a user to set an api key.

Return value

\Drupal\Core\Access\AccessResultInterface The result.

1 string reference to 'TestMailForm::access'
sparkpost.routing.yml in ./sparkpost.routing.yml
sparkpost.routing.yml

File

src/Form/TestMailForm.php, line 128

Class

TestMailForm
The form for sending test mails from Sparkpost.

Namespace

Drupal\sparkpost\Form

Code

public function access(AccountInterface $account) {
  $config = \Drupal::config('sparkpost.settings');
  if ($config
    ->get('api_key')) {
    return AccessResult::allowedIfHasPermission($account, 'administer sparkpost');
  }
  return AccessResult::forbidden();
}