You are here

protected function CommentAlterListStringTest::addOptionField in Comment Alter 8

Adds an Option Field to the parent enity.

Parameters

string $widget_type: The widget type (Eg. options_select).

int $cardinality: Cardinality of the field.

Return value

string The name of the field which was created.

4 calls to CommentAlterListStringTest::addOptionField()
CommentAlterListStringTest::testOptionsButtonMultiple in tests/src/Functional/CommentAlterListStringTest.php
Tests for multi-valued List (string) fields comment altering.
CommentAlterListStringTest::testOptionsButtonSingle in tests/src/Functional/CommentAlterListStringTest.php
Tests for single valued List (string) fields comment altering.
CommentAlterListStringTest::testOptionsSelectMultiple in tests/src/Functional/CommentAlterListStringTest.php
Tests for multi-valued List (string) fields comment altering.
CommentAlterListStringTest::testOptionsSelectSingle in tests/src/Functional/CommentAlterListStringTest.php
Tests for single valued List (string) fields comment altering.

File

tests/src/Functional/CommentAlterListStringTest.php, line 30

Class

CommentAlterListStringTest
Tests the comment alter module functions for List (string) fields.

Namespace

Drupal\Tests\comment_alter\Functional

Code

protected function addOptionField($widget_type, $cardinality) {
  return $this
    ->addField('list_string', $widget_type, [
    'settings' => [
      'allowed_values' => [
        1 => 'One',
        2 => 'Two',
      ],
    ],
    'cardinality' => $cardinality,
  ]);
}