You are here

protected function RangeFieldUiTest::getFieldEdit in Range 8

Returns field edit array for a given field type.

Parameters

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

Return value

array Range field edit array.

1 call to RangeFieldUiTest::getFieldEdit()
RangeFieldUiTest::rangeTestAddNewField in tests/src/Functional/RangeFieldUiTest.php
Test creating range field via field UI.

File

tests/src/Functional/RangeFieldUiTest.php, line 145

Class

RangeFieldUiTest
Tests adding range fields and their settings via field UI.

Namespace

Drupal\Tests\range\Functional

Code

protected function getFieldEdit($field_type = 'range_integer') {
  $test_settings = $this
    ->getTestFieldSettings($field_type);
  switch ($field_type) {
    case 'range_integer':
    case 'range_float':
    case 'range_decimal':
      return [
        'settings[min]' => $test_settings['min'],
        'settings[max]' => $test_settings['max'],
        'settings[field][prefix]' => $test_settings['field']['prefix'],
        'settings[field][suffix]' => $test_settings['field']['suffix'],
        'settings[from][prefix]' => $test_settings['from']['prefix'],
        'settings[from][suffix]' => $test_settings['from']['suffix'],
        'settings[to][prefix]' => $test_settings['to']['prefix'],
        'settings[to][suffix]' => $test_settings['to']['suffix'],
        'settings[combined][prefix]' => $test_settings['combined']['prefix'],
        'settings[combined][suffix]' => $test_settings['combined']['suffix'],
      ];
  }
}