You are here

public function MailchimpConfigurationAccessCheck::access in Mailchimp 8

Same name and namespace in other branches
  1. 2.x src/Access/MailchimpConfigurationAccessCheck.php \Drupal\mailchimp\Access\MailchimpConfigurationAccessCheck::access()

Access check for Mailchimp module configuration.

Ensures a Mailchimp API key has been provided.

Parameters

\Drupal\Core\Session\AccountInterface $account: Run access checks for this account.

Return value

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

File

src/Access/MailchimpConfigurationAccessCheck.php, line 25

Class

MailchimpConfigurationAccessCheck
Checks access for displaying configuration translation page.

Namespace

Drupal\mailchimp\Access

Code

public function access(AccountInterface $account) {
  $config = \Drupal::config('mailchimp.settings');
  $api_key = $config
    ->get('api_key');
  return AccessResult::allowedIf(!empty($api_key));
}