2006-07-13 13:14:25 +00:00
|
|
|
<?php
|
2012-02-29 21:19:26 +00:00
|
|
|
/**
|
|
|
|
* @file
|
|
|
|
* Enables modules and site configuration for a standard site installation.
|
|
|
|
*/
|
2006-07-13 13:14:25 +00:00
|
|
|
|
2014-10-23 12:10:36 +00:00
|
|
|
use Drupal\contact\Entity\ContactForm;
|
2014-08-04 11:21:15 +00:00
|
|
|
use Drupal\Core\Form\FormStateInterface;
|
|
|
|
|
2007-11-19 13:56:14 +00:00
|
|
|
/**
|
2012-02-29 21:19:26 +00:00
|
|
|
* Implements hook_form_FORM_ID_alter() for install_configure_form().
|
2007-11-19 13:56:14 +00:00
|
|
|
*
|
2010-01-03 06:58:52 +00:00
|
|
|
* Allows the profile to alter the site configuration form.
|
2007-11-19 13:56:14 +00:00
|
|
|
*/
|
2014-08-04 11:21:15 +00:00
|
|
|
function standard_form_install_configure_form_alter(&$form, FormStateInterface $form_state) {
|
2010-07-22 16:16:42 +00:00
|
|
|
// Pre-populate the site name with the server name.
|
2013-12-05 18:02:36 +00:00
|
|
|
$form['site_information']['site_name']['#default_value'] = \Drupal::request()->server->get('SERVER_NAME');
|
2014-10-23 12:10:36 +00:00
|
|
|
$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');
|
|
|
|
ContactForm::load('feedback')->setRecipients([$site_mail])->save();
|
2007-11-19 13:56:14 +00:00
|
|
|
}
|