standard.profile 784 Bytes
Newer Older
1
<?php
2 3 4 5
/**
 * @file
 * Enables modules and site configuration for a standard site installation.
 */
6

7
use Drupal\contact\Entity\ContactForm;
8 9
use Drupal\Core\Form\FormStateInterface;

10
/**
11
 * Implements hook_form_FORM_ID_alter() for install_configure_form().
12
 *
13
 * Allows the profile to alter the site configuration form.
14
 */
15
function standard_form_install_configure_form_alter(&$form, FormStateInterface $form_state) {
16 17 18 19 20 21 22 23
  $form['#submit'][] = 'standard_form_install_configure_submit';
}

/**
 * Submission handler to sync the contact.form.feedback recipient.
 */
function standard_form_install_configure_submit($form, FormStateInterface $form_state) {
  $site_mail = $form_state->getValue('site_mail');
24
  ContactForm::load('feedback')->setRecipients([$site_mail])->trustData()->save();
25
}