Updated all the contrib modules to their latest versions.
[yaffs-website] / web / modules / contrib / memcache / memcache_admin / src / Form / MemcacheAdminSettingsForm.php
1 <?php
2
3 namespace Drupal\memcache_admin\Form;
4
5 use Drupal\Core\Form\ConfigFormBase;
6 use Drupal\Core\Form\FormStateInterface;
7
8 /**
9  * Memcache admin settings form.
10  */
11 class MemcacheAdminSettingsForm extends ConfigFormBase {
12
13   /**
14    * {@inheritdoc}
15    */
16   public function getFormId() {
17     return 'memcache_admin_admin_settings';
18   }
19
20   /**
21    * {@inheritdoc}
22    */
23   public function buildForm(array $form, FormStateInterface $form_state) {
24     $form['show_memcache_statistics'] = [
25       '#type'          => 'checkbox',
26       '#title'         => t('Show memcache statistics at the bottom of each page'),
27       '#default_value' => \Drupal::config('memcache_admin.settings')->get('show_memcache_statistics'),
28       '#description'   => t("These statistics will be visible to users with the 'access memcache statistics' permission."),
29     ];
30
31     return parent::buildForm($form, $form_state);
32   }
33
34   /**
35    * {@inheritdoc}
36    */
37   public function getEditableConfigNames() {
38     return ['memcache_admin.settings'];
39   }
40
41   /**
42    * {@inheritdoc}
43    */
44   public function submitForm(array &$form, FormStateInterface $form_state) {
45     $this->config('memcache_admin.settings')
46       ->set('show_memcache_statistics', $form_state->getValue('show_memcache_statistics'))
47       ->save();
48
49     parent::submitForm($form, $form_state);
50   }
51
52 }