standard.profile 785 B

1234567891011121314151617181920212223242526
  1. <?php
  2. /**
  3. * @file
  4. * Enables modules and site configuration for a standard site installation.
  5. */
  6. use Drupal\contact\Entity\ContactForm;
  7. use Drupal\Core\Form\FormStateInterface;
  8. /**
  9. * Implements hook_form_FORM_ID_alter() for install_configure_form().
  10. *
  11. * Allows the profile to alter the site configuration form.
  12. */
  13. function standard_form_install_configure_form_alter(&$form, FormStateInterface $form_state) {
  14. $form['#submit'][] = 'standard_form_install_configure_submit';
  15. }
  16. /**
  17. * Submission handler to sync the contact.form.feedback recipient.
  18. */
  19. function standard_form_install_configure_submit($form, FormStateInterface $form_state) {
  20. $site_mail = $form_state->getValue('site_mail');
  21. ContactForm::load('feedback')->setRecipients([$site_mail])->trustData()->save();
  22. }