Drupal investigation

standard.profile 785B

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