diff --git a/core/modules/contact/src/Controller/ContactController.php b/core/modules/contact/src/Controller/ContactController.php index 0ebadc7..c821e2c 100644 --- a/core/modules/contact/src/Controller/ContactController.php +++ b/core/modules/contact/src/Controller/ContactController.php @@ -78,12 +78,13 @@ public function contactSitePage(ContactFormInterface $contact_form = NULL) { if (!$this->currentUser()->hasPermission('administer contact forms')) { $this->contactFloodControl(); } + $config = $this->config('contact.settings'); // Use the default form if no form has been passed. if (empty($contact_form)) { $contact_form = $this->entityManager() ->getStorage('contact_form') - ->load($this->config('contact.settings')->get('default_form')); + ->load($config->get('default_form')); // If there are no forms, do not display the form. if (empty($contact_form)) { if ($this->currentUser()->hasPermission('administer contact forms')) { @@ -105,7 +106,7 @@ public function contactSitePage(ContactFormInterface $contact_form = NULL) { $form = $this->entityFormBuilder()->getForm($message); $form['#title'] = String::checkPlain($contact_form->label()); - $form['#cache']['tags'] = Cache::mergeTags(isset($form['#cache']['tags']) ? $form['#cache']['tags'] : [], $this->config('contact.settings')->getCacheTags()); + $form['#cache']['tags'] = Cache::mergeTags(isset($form['#cache']['tags']) ? $form['#cache']['tags'] : [], $config->getCacheTags()); return $form; } diff --git a/core/modules/forum/src/Controller/ForumController.php b/core/modules/forum/src/Controller/ForumController.php index 7408763..18d7325 100644 --- a/core/modules/forum/src/Controller/ForumController.php +++ b/core/modules/forum/src/Controller/ForumController.php @@ -191,7 +191,7 @@ protected function build($forums, TermInterface $term, $topics = array(), $paren if (empty($term->forum_container->value)) { $build['#attached']['feed'][] = array('taxonomy/term/' . $term->id() . '/feed', 'RSS - ' . $term->getName()); } - $build['#cache']['tags'] = Cache::mergeTags(isset($build['#cache']['tags']) ? $build['#cache']['tags'] : [], $this->config('forum.settings')->getCacheTags()); + $build['#cache']['tags'] = Cache::mergeTags(isset($build['#cache']['tags']) ? $build['#cache']['tags'] : [], $config->getCacheTags()); return [ 'action' => $this->buildActionLinks($config->get('vocabulary'), $term), diff --git a/core/modules/user/src/Form/UserCancelForm.php b/core/modules/user/src/Form/UserCancelForm.php index 3aa2ee5..3223f14 100644 --- a/core/modules/user/src/Form/UserCancelForm.php +++ b/core/modules/user/src/Form/UserCancelForm.php @@ -77,6 +77,7 @@ public function getConfirmText() { public function buildForm(array $form, FormStateInterface $form_state) { $user = $this->currentUser(); $this->cancelMethods = user_cancel_methods(); + $config = $this->config('user.settings'); // Display account cancellation method selection, if allowed. $admin_access = $user->hasPermission('administer users'); @@ -99,7 +100,7 @@ public function buildForm(array $form, FormStateInterface $form_state) { '#description' => $this->t('When enabled, the user must confirm the account cancellation via email.'), ); // Also allow to send account canceled notification mail, if enabled. - $default_notify = $this->config('user.settings')->get('notify.status_canceled'); + $default_notify = $config->get('notify.status_canceled'); $form['user_cancel_notify'] = array( '#type' => 'checkbox', '#title' => $this->t('Notify user when account is canceled'), @@ -113,7 +114,7 @@ public function buildForm(array $form, FormStateInterface $form_state) { $form = parent::buildForm($form, $form_state); - $form['#cache']['tags'] = Cache::mergeTags(isset($form['#cache']['tags']) ? $form['#cache']['tags'] : [], $this->config('user.settings')->getCacheTags()); + $form['#cache']['tags'] = Cache::mergeTags(isset($form['#cache']['tags']) ? $form['#cache']['tags'] : [], $config->getCacheTags()); return $form; } diff --git a/core/modules/user/src/Form/UserLoginForm.php b/core/modules/user/src/Form/UserLoginForm.php index 25c901d..a0c0876 100644 --- a/core/modules/user/src/Form/UserLoginForm.php +++ b/core/modules/user/src/Form/UserLoginForm.php @@ -79,13 +79,15 @@ public function getFormId() { * {@inheritdoc} */ public function buildForm(array $form, FormStateInterface $form_state) { + $config = $this->config('system.site'); + // Display login form: $form['name'] = array( '#type' => 'textfield', '#title' => $this->t('Username'), '#size' => 60, '#maxlength' => USERNAME_MAX_LENGTH, - '#description' => $this->t('Enter your @s username.', array('@s' => $this->config('system.site')->get('name'))), + '#description' => $this->t('Enter your @s username.', array('@s' => $config->get('name'))), '#required' => TRUE, '#attributes' => array( 'autocorrect' => 'off', @@ -110,7 +112,7 @@ public function buildForm(array $form, FormStateInterface $form_state) { $form['#validate'][] = '::validateAuthentication'; $form['#validate'][] = '::validateFinal'; - $form['#cache']['tags'] = Cache::mergeTags(isset($form['#cache']['tags']) ? $form['#cache']['tags'] : [], $this->config('system.site')->getCacheTags()); + $form['#cache']['tags'] = Cache::mergeTags(isset($form['#cache']['tags']) ? $form['#cache']['tags'] : [], $config->getCacheTags()); return $form; }