class MandrillConfigurationAccessCheck in Mandrill 8
Checks access for displaying configuration page.
Hierarchy
- class \Drupal\mandrill\Access\MandrillConfigurationAccessCheck implements AccessInterface
Expanded class hierarchy of MandrillConfigurationAccessCheck
1 string reference to 'MandrillConfigurationAccessCheck'
1 service uses MandrillConfigurationAccessCheck
File
- src/
Access/ MandrillConfigurationAccessCheck.php, line 12
Namespace
Drupal\mandrill\AccessView source
class MandrillConfigurationAccessCheck implements AccessInterface {
/**
* Access check for Mandrill module configuration.
*
* Ensures a Mandrill 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::configFactory()
->get('mandrill.settings');
$api_key = $config
->get('mandrill_api_key');
return AccessResult::allowedIf(!empty($api_key));
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
MandrillConfigurationAccessCheck:: |
public | function | Access check for Mandrill module configuration. |