class MailchimpConfigurationAccessCheck in Mailchimp 8
Same name and namespace in other branches
- 2.x src/Access/MailchimpConfigurationAccessCheck.php \Drupal\mailchimp\Access\MailchimpConfigurationAccessCheck
Checks access for displaying configuration translation page.
Hierarchy
- class \Drupal\mailchimp\Access\MailchimpConfigurationAccessCheck implements AccessInterface
Expanded class hierarchy of MailchimpConfigurationAccessCheck
1 string reference to 'MailchimpConfigurationAccessCheck'
1 service uses MailchimpConfigurationAccessCheck
File
- src/
Access/ MailchimpConfigurationAccessCheck.php, line 12
Namespace
Drupal\mailchimp\AccessView 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
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
MailchimpConfigurationAccessCheck:: |
public | function | Access check for Mailchimp module configuration. |