You are here

public function MandrillMailerAccessCheck::access in Mandrill 8

Access check for Mandrill module configuration.

Ensures a Mandrill API key has been provided.

Return value

\Drupal\Core\Access\AccessResultInterface The access result.

File

src/Access/MandrillMailerAccessCheck.php, line 21

Class

MandrillMailerAccessCheck
Checks access for displaying configuration page.

Namespace

Drupal\mandrill\Access

Code

public function access() {
  $sender = \Drupal::config('mailsystem.settings')
    ->get('defaults')['sender'];
  return AccessResult::allowedIf(in_array($sender, [
    'mandrill_mail',
    'mandrill_test_mail',
  ]));
}