diff --git a/core/modules/contact/lib/Drupal/contact/Access/ContactPageAccess.php b/core/modules/contact/lib/Drupal/contact/Access/ContactPageAccess.php index fc4de8d..ee9835d 100644 --- a/core/modules/contact/lib/Drupal/contact/Access/ContactPageAccess.php +++ b/core/modules/contact/lib/Drupal/contact/Access/ContactPageAccess.php @@ -23,7 +23,7 @@ class ContactPageAccess implements StaticAccessCheckInterface { * * @var \Drupal\Core\Config\Config */ - protected $config; + protected $contactSettings; /** * The user data service. @@ -41,7 +41,7 @@ class ContactPageAccess implements StaticAccessCheckInterface { * The user data service. */ public function __construct(ConfigFactory $config_factory, UserDataInterface $user_data) { - $this->config = $config_factory->get('contact.settings'); + $this->contactSettings = $config_factory->get('contact.settings'); $this->userData = $user_data; } @@ -89,11 +89,11 @@ public function access(Route $route, Request $request) { } // If the requested user did not save a preference yet, deny access if the // configured default is disabled. - elseif (!$this->config->get('user_default_enabled')) { + elseif (!$this->contactSettings->get('user_default_enabled')) { return static::DENY; } - return $current_account->hasPermission('access user contact forms'); + return $current_account->hasPermission('access user contact forms') ? static::ALLOW : static::DENY; } } diff --git a/core/modules/contact/lib/Drupal/contact/CategoryAccessController.php b/core/modules/contact/lib/Drupal/contact/CategoryAccessController.php index af7ae55..58b91ea 100644 --- a/core/modules/contact/lib/Drupal/contact/CategoryAccessController.php +++ b/core/modules/contact/lib/Drupal/contact/CategoryAccessController.php @@ -22,7 +22,8 @@ class CategoryAccessController extends EntityAccessController { */ public function checkAccess(EntityInterface $entity, $operation, $langcode, AccountInterface $account) { if ($operation == 'delete' || $operation == 'update') { - // Do not allow delete 'personal' category used for personal contact form. + // Do not allow the 'personal' category to be deleted, as it's used for + // the personal contact form. return $account->hasPermission('administer contact forms') && $entity->id() !== 'personal'; } elseif ($operation == 'page') { diff --git a/core/modules/contact/lib/Drupal/contact/Controller/ContactPageController.php b/core/modules/contact/lib/Drupal/contact/Controller/ContactPageController.php index b4fad38..4f529de 100644 --- a/core/modules/contact/lib/Drupal/contact/Controller/ContactPageController.php +++ b/core/modules/contact/lib/Drupal/contact/Controller/ContactPageController.php @@ -33,11 +33,11 @@ class ContactPageController implements ControllerInterface { protected $flood; /** - * The config factory. + * The contact settings config object. * - * @var \Drupal\Core\Config\ConfigFactory + * @var \Drupal\Core\Config\Config */ - protected $configFactory; + protected $contactSettings; /** * The entity manager. @@ -76,7 +76,7 @@ class ContactPageController implements ControllerInterface { */ public function __construct(FloodInterface $flood, ConfigFactory $config_factory, EntityManager $entity_manager, PathBasedGeneratorInterface $url_generator, TranslatorInterface $translator) { $this->flood = $flood; - $this->configFactory = $config_factory; + $this->contactSettings = $config_factory->get('contact.settings'); $this->entityManager = $entity_manager; $this->urlGenerator = $url_generator; $this->translator = $translator; @@ -118,7 +118,7 @@ public function contactSitePage(AccountInterface $_account, Category $contact_ca // Use the default category if no category has been passed. if (empty($contact_category)) { - $default_category = $this->configFactory->get('contact.settings')->get('default_category'); + $default_category = $this->contactSettings->get('default_category'); $contact_category = $this->entityManager ->getStorageController('contact_category') ->load($default_category); @@ -179,9 +179,8 @@ public function contactPersonalPage(UserInterface $user, AccountInterface $_acco * @throws \Symfony\Component\HttpKernel\Exception\AccessDeniedHttpException */ protected function contactFloodControl() { - $contact_settings = $this->configFactory->get('contact.settings'); - $limit = $contact_settings->get('flood.limit'); - $interval = $contact_settings->get('flood.interval'); + $limit = $this->contactSettings->get('flood.limit'); + $interval = $this->contactSettings->get('flood.interval'); if (!$this->flood->isAllowed('contact', $limit, $interval)) { drupal_set_message($this->translator->translate('You cannot send more than %limit messages in @interval. Try again later.', array( '%limit' => $limit,