Skip to content
Snippets Groups Projects
Commit 9a19c4e4 authored by Alex Pott's avatar Alex Pott
Browse files

Issue #2349651 by larowlan, yannisc: Fixed Default contact form does not send...

Issue #2349651 by larowlan, yannisc: Fixed Default contact form does not send email as email recipient is not set during the installation.
parent b99effe2
No related branches found
No related tags found
2 merge requests!7452Issue #1797438. HTML5 validation is preventing form submit and not fully...,!789Issue #3210310: Adjust Database API to remove deprecated Drupal 9 code in Drupal 10
Showing with 41 additions and 4 deletions
......@@ -27,7 +27,7 @@ class ConfigTranslationUiTest extends WebTestBase {
*
* @var array
*/
public static $modules = array('node', 'contact', 'config_translation', 'config_translation_test', 'views', 'views_ui', 'contextual');
public static $modules = array('node', 'contact', 'contact_test', 'config_translation', 'config_translation_test', 'views', 'views_ui', 'contextual');
/**
* Languages to enable.
......
......@@ -23,7 +23,7 @@ class ContactSitewideTest extends WebTestBase {
*
* @var array
*/
public static $modules = array('text', 'contact', 'field_ui');
public static $modules = array('text', 'contact', 'field_ui', 'contact_test');
/**
* Tests configuration options and the site-wide contact form.
......
......@@ -27,6 +27,7 @@ class ContactStorageTest extends ContactSitewideTest {
'contact',
'field_ui',
'contact_storage_test',
'contact_test',
);
public static function getInfo() {
......
......@@ -22,7 +22,13 @@ class MessageEntityTest extends KernelTestBase {
*
* @var array
*/
public static $modules = array('system', 'contact', 'field', 'user');
public static $modules = array(
'system',
'contact',
'field',
'user',
'contact_test',
);
protected function setUp() {
parent::setUp();
......
name: 'Contact test module'
type: module
description: 'Contains test contact form.'
package: Testing
version: VERSION
core: 8.x
dependencies:
- contact
......@@ -22,7 +22,7 @@ class LocaleConfigTranslationTest extends WebTestBase {
*
* @var array
*/
public static $modules = array('locale', 'contact');
public static $modules = array('locale', 'contact', 'contact_test');
/**
* {@inheritdoc}
......
id: feedback
label: 'Website feedback'
recipients: { }
reply: ''
weight: 0
status: true
langcode: en
......@@ -8,6 +8,7 @@
namespace Drupal\standard\Tests;
use Drupal\config\Tests\SchemaCheckTestTrait;
use Drupal\contact\Entity\ContactForm;
use Drupal\simpletest\WebTestBase;
/**
......@@ -112,6 +113,10 @@ function testStandard() {
\Drupal::moduleHandler()->uninstall(array('editor', 'ckeditor'));
$this->rebuildContainer();
\Drupal::moduleHandler()->install(array('editor'));
/** @var \Drupal\contact\ContactFormInterface $contact_form */
$contact_form = ContactForm::load('feedback');
$recipients = $contact_form->getRecipients();
$this->assertEqual(['simpletest@example.com'], $recipients);
}
}
......@@ -4,6 +4,7 @@
* Enables modules and site configuration for a standard site installation.
*/
use Drupal\contact\Entity\ContactForm;
use Drupal\Core\Form\FormStateInterface;
/**
......@@ -14,4 +15,13 @@
function standard_form_install_configure_form_alter(&$form, FormStateInterface $form_state) {
// Pre-populate the site name with the server name.
$form['site_information']['site_name']['#default_value'] = \Drupal::request()->server->get('SERVER_NAME');
$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();
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment