Drupal investigation

contact.post_update.php 495B

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