-
Notifications
You must be signed in to change notification settings - Fork 17
Expand file tree
/
Copy pathcommerce_base.profile
More file actions
28 lines (24 loc) · 971 Bytes
/
commerce_base.profile
File metadata and controls
28 lines (24 loc) · 971 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
<?php
/**
* @file
* Enables modules and site configuration for a commerce_base site installation.
*/
use Drupal\contact\Entity\ContactForm;
use Drupal\Core\Form\FormStateInterface;
/**
* Implements hook_form_FORM_ID_alter() for install_configure_form().
*
* Allows the profile to alter the site configuration form.
*/
function commerce_base_form_install_configure_form_alter(&$form, FormStateInterface $form_state) {
// Add a placeholder as example that one can choose an arbitrary site name.
$form['site_information']['site_name']['#attributes']['placeholder'] = t('My store');
$form['#submit'][] = 'commerce_base_form_install_configure_submit';
}
/**
* Submission handler to sync the contact.form.feedback recipient.
*/
function commerce_base_form_install_configure_submit($form, FormStateInterface $form_state) {
$site_mail = $form_state->getValue('site_mail');
ContactForm::load('feedback')->setRecipients([$site_mail])->trustData()->save();
}