You are here

public function TestItem::fieldSettingsForm in Drupal 8

Same name and namespace in other branches
  1. 9 core/modules/field/tests/modules/field_test/src/Plugin/Field/FieldType/TestItem.php \Drupal\field_test\Plugin\Field\FieldType\TestItem::fieldSettingsForm()

Returns a form for the field-level settings.

Invoked from \Drupal\field_ui\Form\FieldConfigEditForm to allow administrators to configure field-level settings.

Parameters

array $form: The form where the settings form is being included in.

\Drupal\Core\Form\FormStateInterface $form_state: The form state of the (entire) configuration form.

Return value

array The form definition for the field settings.

Overrides FieldItemBase::fieldSettingsForm

File

core/modules/field/tests/modules/field_test/src/Plugin/Field/FieldType/TestItem.php, line 91

Class

TestItem
Defines the 'test_field' entity field item.

Namespace

Drupal\field_test\Plugin\Field\FieldType

Code

public function fieldSettingsForm(array $form, FormStateInterface $form_state) {
  $form['test_field_setting'] = [
    '#type' => 'textfield',
    '#title' => t('Field test field setting'),
    '#default_value' => $this
      ->getSetting('test_field_setting'),
    '#required' => FALSE,
    '#description' => t('A dummy form element to simulate field setting.'),
  ];
  return $form;
}