public function AutocompleteWidgetBase::settingsForm

Overrides \Drupal\field\Plugin\Type\Widget\WidgetBase::settingsForm().

Overrides WidgetBase::settingsForm

File

drupal/core/modules/entity_reference/lib/Drupal/entity_reference/Plugin/field/widget/AutocompleteWidgetBase.php, line 22
Contains \Drupal\entity_reference\Plugin\field\widget\AutocompleteWidgetBase.

Class

AutocompleteWidgetBase
Parent plugin for entity reference autocomplete widgets.

Namespace

Drupal\entity_reference\Plugin\field\widget

Code

public function settingsForm(array $form, array &$form_state) {
  $element['match_operator'] = array(
    '#type' => 'radios',
    '#title' => t('Autocomplete matching'),
    '#default_value' => $this
      ->getSetting('match_operator'),
    '#options' => array(
      'STARTS_WITH' => t('Starts with'),
      'CONTAINS' => t('Contains'),
    ),
    '#description' => t('Select the method used to collect autocomplete suggestions. Note that <em>Contains</em> can cause performance issues on sites with thousands of entities.'),
  );
  $element['size'] = array(
    '#type' => 'number',
    '#title' => t('Size of textfield'),
    '#default_value' => $this
      ->getSetting('size'),
    '#min' => 1,
    '#required' => TRUE,
  );
  $element['placeholder'] = array(
    '#type' => 'textfield',
    '#title' => t('Placeholder'),
    '#default_value' => $this
      ->getSetting('placeholder'),
    '#description' => t('Text that will be shown inside the field until a value is entered. This hint is usually a sample value or a brief description of the expected format.'),
  );
  return $element;
}