function ContactSitewideTest::addContactForm

Same name in other branches
  1. 9 core/modules/contact/tests/src/Functional/ContactSitewideTest.php \Drupal\Tests\contact\Functional\ContactSitewideTest::addContactForm()
  2. 10 core/modules/contact/tests/src/Functional/ContactSitewideTest.php \Drupal\Tests\contact\Functional\ContactSitewideTest::addContactForm()
  3. 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 501

Class

ContactSitewideTest
Tests site-wide contact form functionality.

Namespace

Drupal\Tests\contact\Functional

Code

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->drupalPostForm('admin/structure/contact/add', $edit, t('Save'));
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.