function ContactSitewideTest::addContactForm
Same name in other branches
- 9 core/modules/contact/tests/src/Functional/ContactSitewideTest.php \Drupal\Tests\contact\Functional\ContactSitewideTest::addContactForm()
- 8.9.x core/modules/contact/tests/src/Functional/ContactSitewideTest.php \Drupal\Tests\contact\Functional\ContactSitewideTest::addContactForm()
- 11.x core/modules/contact/tests/src/Functional/ContactSitewideTest.php \Drupal\Tests\contact\Functional\ContactSitewideTest::addContactForm()
Adds a form.
Parameters
string $id: The form machine name.
string $label: The form label.
string $recipients: The list of recipient email addresses.
string $reply: The auto-reply text that is sent to a user upon completing the contact form.
bool $selected: A Boolean indicating whether the form should be selected by default.
string $message: The message that will be displayed to a user upon completing the contact form.
array $third_party_settings: Array of third party settings to be added to the posted form data.
3 calls to ContactSitewideTest::addContactForm()
- ContactSitewideTest::testAutoReply in core/
modules/ contact/ tests/ src/ Functional/ ContactSitewideTest.php - Tests auto-reply on the site-wide contact form.
- ContactSitewideTest::testSiteWideContact in core/
modules/ contact/ tests/ src/ Functional/ ContactSitewideTest.php - Tests configuration options and the site-wide contact form.
- ContactStorageTest::testContactStorage in core/
modules/ contact/ tests/ src/ Functional/ ContactStorageTest.php - Tests configuration options and the site-wide contact form.
File
-
core/
modules/ contact/ tests/ src/ Functional/ ContactSitewideTest.php, line 524
Class
- ContactSitewideTest
- Tests site-wide contact form functionality.
Namespace
Drupal\Tests\contact\FunctionalCode
public function addContactForm($id, $label, $recipients, $reply, $selected, $message = 'Your message has been sent.', $third_party_settings = []) {
$edit = [];
$edit['label'] = $label;
$edit['id'] = $id;
$edit['message'] = $message;
$edit['recipients'] = $recipients;
$edit['reply'] = $reply;
$edit['selected'] = $selected ? TRUE : FALSE;
$edit += $third_party_settings;
$this->drupalGet('admin/structure/contact/add');
$this->submitForm($edit, 'Save');
// Ensure the statically cached bundle info is aware of the contact form
// that was just created in the UI.
$this->container
->get('entity_type.bundle.info')
->clearCachedBundles();
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.