Security update for Core, with self-updated composer
[yaffs-website] / web / core / modules / system / tests / modules / ajax_forms_test / src / Form / AjaxFormsTestImageButtonForm.php
diff --git a/web/core/modules/system/tests/modules/ajax_forms_test/src/Form/AjaxFormsTestImageButtonForm.php b/web/core/modules/system/tests/modules/ajax_forms_test/src/Form/AjaxFormsTestImageButtonForm.php
new file mode 100644 (file)
index 0000000..20754ff
--- /dev/null
@@ -0,0 +1,48 @@
+<?php
+
+namespace Drupal\ajax_forms_test\Form;
+
+use Drupal\ajax_forms_test\Callbacks;
+use Drupal\Core\Form\FormBase;
+use Drupal\Core\Form\FormStateInterface;
+
+/**
+ * Form builder: Builds a form that has image button with an ajax callback.
+ */
+class AjaxFormsTestImageButtonForm extends FormBase {
+
+  /**
+   * {@inheritdoc}
+   */
+  public function getFormId() {
+    return 'ajax_forms_test_image_button_form';
+  }
+
+  /**
+   * {@inheritdoc}
+   */
+  public function buildForm(array $form, FormStateInterface $form_state) {
+    $object = new Callbacks();
+    $form['image_button'] = [
+      '#type' => 'image_button',
+      '#name' => 'image_button',
+      '#src' => 'core/misc/icons/787878/cog.svg',
+      '#attributes' => ['alt' => $this->t('Edit')],
+      '#op' => 'edit',
+      '#ajax' => [
+        'callback' => [$object, 'imageButtonCallback'],
+      ],
+      '#suffix' => '<div id="ajax_image_button_result">Image button not pressed yet.</div>',
+    ];
+
+    return $form;
+  }
+
+  /**
+   * {@inheritdoc}
+   */
+  public function submitForm(array &$form, FormStateInterface $form_state) {
+    // No submit code needed.
+  }
+
+}