Version 1
[yaffs-website] / web / core / modules / contact / contact.post_update.php
diff --git a/web/core/modules/contact/contact.post_update.php b/web/core/modules/contact/contact.post_update.php
new file mode 100644 (file)
index 0000000..7b3b766
--- /dev/null
@@ -0,0 +1,22 @@
+<?php
+
+/**
+ * @file
+ * Post update functions for Contact.
+ */
+
+use Drupal\contact\Entity\ContactForm;
+
+
+/**
+ * Initialize 'message' and 'redirect' field values to 'contact_form' entities.
+ */
+function contact_post_update_add_message_redirect_field_to_contact_form() {
+  /** @var \Drupal\contact\ContactFormInterface $contact */
+  foreach (ContactForm::loadMultiple() as $contact) {
+    $contact
+      ->setMessage('Your message has been sent.')
+      ->setRedirectPath('')
+      ->save();
+  }
+}