You are here

private function AbstractFormEntityDisplayEditAlterEventSubscriberTestCase::getTestForm in Hook Event Dispatcher 3.x

Same name and namespace in other branches
  1. 8.2 modules/field_event_dispatcher/tests/src/Unit/Field/AbstractFormEntityDisplayEditAlterEventSubscriberTestCase.php \Drupal\Tests\field_event_dispatcher\Unit\Field\AbstractFormEntityDisplayEditAlterEventSubscriberTestCase::getTestForm()

Get a basic test form.

The required structure for the $fields parameter array is:


 'field_test1' => ['test_module' => ['test']],
 'field_test2' => ['test_module' => ['test']],

Parameters

array $fields: An array containing zero or more fields and their third-party settings to create and return as a form.

Return value

array A basic form array with the field structure in $fields added.

4 calls to AbstractFormEntityDisplayEditAlterEventSubscriberTestCase::getTestForm()
AbstractFormEntityDisplayEditAlterEventSubscriberTestCase::testFormAlterMultipleMerges in modules/field_event_dispatcher/tests/src/Unit/Field/AbstractFormEntityDisplayEditAlterEventSubscriberTestCase.php
FormEntityDisplayEditAlterEventSubscriber test with multiple merges.
AbstractFormEntityDisplayEditAlterEventSubscriberTestCase::testFormAlterNoFields in modules/field_event_dispatcher/tests/src/Unit/Field/AbstractFormEntityDisplayEditAlterEventSubscriberTestCase.php
FormEntityDisplayEditAlterEventSubscriber test with no fields.
AbstractFormEntityDisplayEditAlterEventSubscriberTestCase::testFormAlterOneField in modules/field_event_dispatcher/tests/src/Unit/Field/AbstractFormEntityDisplayEditAlterEventSubscriberTestCase.php
FormEntityDisplayEditAlterEventSubscriber test with one field.
AbstractFormEntityDisplayEditAlterEventSubscriberTestCase::testFormAlterTwoFields in modules/field_event_dispatcher/tests/src/Unit/Field/AbstractFormEntityDisplayEditAlterEventSubscriberTestCase.php
FormEntityDisplayEditAlterEventSubscriber test with two fields.

File

modules/field_event_dispatcher/tests/src/Unit/Field/AbstractFormEntityDisplayEditAlterEventSubscriberTestCase.php, line 55

Class

AbstractFormEntityDisplayEditAlterEventSubscriberTestCase
Class AbstractFormEntityDisplayEditAlterEventSubscriberTestCase.

Namespace

Drupal\Tests\field_event_dispatcher\Unit\Field

Code

private function getTestForm(array $fields) : array {
  $form = [
    '#fields' => [],
  ];
  foreach ($fields as $fieldName => $thirdPartySettings) {
    $form['#fields'][] = $fieldName;
    $form['fields'][$fieldName]['plugin']['settings_edit_form']['third_party_settings']['field_event_dispatcher'] = $thirdPartySettings;
  }
  return $form;
}