You are here

class MailchimpConfigurationAccessCheck in Mailchimp 2.x

Same name and namespace in other branches
  1. 8 src/Access/MailchimpConfigurationAccessCheck.php \Drupal\mailchimp\Access\MailchimpConfigurationAccessCheck

Checks access for displaying configuration translation page.

Hierarchy

Expanded class hierarchy of MailchimpConfigurationAccessCheck

1 string reference to 'MailchimpConfigurationAccessCheck'
mailchimp.services.yml in ./mailchimp.services.yml
mailchimp.services.yml
1 service uses MailchimpConfigurationAccessCheck
access_check.mailchimp.configuration in ./mailchimp.services.yml
Drupal\mailchimp\Access\MailchimpConfigurationAccessCheck

File

src/Access/MailchimpConfigurationAccessCheck.php, line 12

Namespace

Drupal\mailchimp\Access
View source
class MailchimpConfigurationAccessCheck implements AccessInterface {

  /**
   * Access check for Mailchimp module configuration.
   *
   * Ensures a Mailchimp API key has been provided.
   *
   * @param \Drupal\Core\Session\AccountInterface $account
   *   Run access checks for this account.
   *
   * @return \Drupal\Core\Access\AccessResultInterface
   *   The access result.
   */
  public function access(AccountInterface $account) {
    $config = \Drupal::config('mailchimp.settings');
    $api_key = $config
      ->get('api_key');
    return AccessResult::allowedIf(!empty($api_key));
  }

}

Members

Namesort descending Modifiers Type Description Overrides
MailchimpConfigurationAccessCheck::access public function Access check for Mailchimp module configuration.