Security update for Core, with self-updated composer
[yaffs-website] / web / core / modules / system / tests / modules / ajax_forms_test / src / Callbacks.php
index 0ad80c9250a1df953389553678a722f641eba077..9b35ef7694fc921b13249c28497b462ea0558ce9 100644 (file)
@@ -22,6 +22,28 @@ class Callbacks {
     return $response;
   }
 
+  /**
+   * Ajax callback triggered by date.
+   */
+  public function dateCallback($form, FormStateInterface $form_state) {
+    $response = new AjaxResponse();
+    $response->addCommand(new HtmlCommand('#ajax_date_value', $form_state->getValue('date')));
+    $response->addCommand(new DataCommand('#ajax_date_value', 'form_state_value_date', $form_state->getValue('date')));
+    return $response;
+  }
+
+  /**
+   * Ajax callback triggered by datetime.
+   */
+  public function datetimeCallback($form, FormStateInterface $form_state) {
+    $datetime = $form_state->getValue('datetime')['date'] . ' ' . $form_state->getValue('datetime')['time'];
+
+    $response = new AjaxResponse();
+    $response->addCommand(new HtmlCommand('#ajax_datetime_value', $datetime));
+    $response->addCommand(new DataCommand('#ajax_datetime_value', 'form_state_value_datetime', $datetime));
+    return $response;
+  }
+
   /**
    * Ajax callback triggered by checkbox.
    */
@@ -32,6 +54,15 @@ class Callbacks {
     return $response;
   }
 
+  /**
+   * Ajax callback to confirm image button was submitted.
+   */
+  public function imageButtonCallback($form, FormStateInterface $form_state) {
+    $response = new AjaxResponse();
+    $response->addCommand(new HtmlCommand('#ajax_image_button_result', "<div id='ajax-1-more-div'>Something witty!</div>"));
+    return $response;
+  }
+
   /**
    * Ajax callback triggered by the checkbox in a #group.
    */