You are here

protected function RangeTestTrait::setFormDisplayComponent in Range 8

Sets the display settings for a default form display.

Parameters

string $field_type: Range field type. Could be one of the following values: range_integer, range_float or range_decimal.

array $settings: Array of display settings.

1 call to RangeTestTrait::setFormDisplayComponent()
WidgetTest::testFieldWidget in tests/src/Kernel/Widget/WidgetTest.php
Tests widget.

File

tests/src/Traits/RangeTestTrait.php, line 214

Class

RangeTestTrait
Provides helper methods to test range fields.

Namespace

Drupal\Tests\range\Traits

Code

protected function setFormDisplayComponent($field_type = 'range_integer', array $settings = []) {
  if (!$this->formDisplay) {
    $this
      ->createFormDisplay();
  }
  $this->formDisplay
    ->setComponent($this
    ->getFieldName($field_type), [
    'type' => 'range',
    'settings' => $settings,
  ]);
  $this->formDisplay
    ->save();
}