Updated all the contrib modules to their latest versions.
[yaffs-website] / web / modules / contrib / memcache / memcache_admin / src / Form / MemcacheAdminSettingsForm.php
diff --git a/web/modules/contrib/memcache/memcache_admin/src/Form/MemcacheAdminSettingsForm.php b/web/modules/contrib/memcache/memcache_admin/src/Form/MemcacheAdminSettingsForm.php
new file mode 100644 (file)
index 0000000..e33a2bd
--- /dev/null
@@ -0,0 +1,52 @@
+<?php
+
+namespace Drupal\memcache_admin\Form;
+
+use Drupal\Core\Form\ConfigFormBase;
+use Drupal\Core\Form\FormStateInterface;
+
+/**
+ * Memcache admin settings form.
+ */
+class MemcacheAdminSettingsForm extends ConfigFormBase {
+
+  /**
+   * {@inheritdoc}
+   */
+  public function getFormId() {
+    return 'memcache_admin_admin_settings';
+  }
+
+  /**
+   * {@inheritdoc}
+   */
+  public function buildForm(array $form, FormStateInterface $form_state) {
+    $form['show_memcache_statistics'] = [
+      '#type'          => 'checkbox',
+      '#title'         => t('Show memcache statistics at the bottom of each page'),
+      '#default_value' => \Drupal::config('memcache_admin.settings')->get('show_memcache_statistics'),
+      '#description'   => t("These statistics will be visible to users with the 'access memcache statistics' permission."),
+    ];
+
+    return parent::buildForm($form, $form_state);
+  }
+
+  /**
+   * {@inheritdoc}
+   */
+  public function getEditableConfigNames() {
+    return ['memcache_admin.settings'];
+  }
+
+  /**
+   * {@inheritdoc}
+   */
+  public function submitForm(array &$form, FormStateInterface $form_state) {
+    $this->config('memcache_admin.settings')
+      ->set('show_memcache_statistics', $form_state->getValue('show_memcache_statistics'))
+      ->save();
+
+    parent::submitForm($form, $form_state);
+  }
+
+}