You are here

public static function DoubleField::defaultFieldSettings in Double Field 4.x

Same name and namespace in other branches
  1. 8.3 src/Plugin/Field/FieldType/DoubleField.php \Drupal\double_field\Plugin\Field\FieldType\DoubleField::defaultFieldSettings()

Defines the field-level settings for this plugin.

Return value

array A list of default settings, keyed by the setting name.

Overrides FieldItemBase::defaultFieldSettings

1 call to DoubleField::defaultFieldSettings()
TestBase::createField in tests/src/FunctionalJavascript/TestBase.php
Creates a field.

File

src/Plugin/Field/FieldType/DoubleField.php, line 139

Class

DoubleField
Plugin implementation of the 'double_field' field type.

Namespace

Drupal\double_field\Plugin\Field\FieldType

Code

public static function defaultFieldSettings() : array {
  $settings = [];
  foreach ([
    'first',
    'second',
  ] as $subfield) {
    $settings[$subfield] = [
      'label' => '',
      'min' => '',
      'max' => '',
      'list' => FALSE,
      'allowed_values' => [],
      'required' => TRUE,
      'on_label' => t('On'),
      'off_label' => t('Off'),
    ];
  }
  return $settings + parent::defaultFieldSettings();
}