contact.post_update.php 494 B

123456789101112131415161718192021
  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. }