contact.post_update.php

Same filename in other branches
  1. 9 core/modules/contact/contact.post_update.php
  2. 10 core/modules/contact/contact.post_update.php
  3. 11.x core/modules/contact/contact.post_update.php

Post update functions for Contact.

File

core/modules/contact/contact.post_update.php

View source
<?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();
    }
}

Functions

Title Deprecated Summary
contact_post_update_add_message_redirect_field_to_contact_form Initialize 'message' and 'redirect' field values to 'contact_form' entities.

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.