contact.post_update.php 495 B

12345678910111213141516171819202122
  1. <?php
  2. /**
  3. * @file
  4. * Post update functions for Contact.
  5. */
  6. use Drupal\contact\Entity\ContactForm;
  7. /**
  8. * Initialize 'message' and 'redirect' field values to 'contact_form' entities.
  9. */
  10. function contact_post_update_add_message_redirect_field_to_contact_form() {
  11. /** @var \Drupal\contact\ContactFormInterface $contact */
  12. foreach (ContactForm::loadMultiple() as $contact) {
  13. $contact
  14. ->setMessage('Your message has been sent.')
  15. ->setRedirectPath('')
  16. ->save();
  17. }
  18. }