You are here

public function AutocompleteWidgetBase::formElement in Entity reference 8

Implements Drupal\field\Plugin\Type\Widget\WidgetInterface::formElement().

2 methods override AutocompleteWidgetBase::formElement()
AutocompleteTagsWidget::formElement in lib/Drupal/entityreference/Plugin/field/widget/AutocompleteTagsWidget.php
Implements Drupal\field\Plugin\Type\Widget\WidgetInterface::formElement().
AutocompleteWidget::formElement in lib/Drupal/entityreference/Plugin/field/widget/AutocompleteWidget.php
Implements Drupal\field\Plugin\Type\Widget\WidgetInterface::formElement().

File

lib/Drupal/entityreference/Plugin/field/widget/AutocompleteWidgetBase.php, line 50
Definition of Drupal\entityreference\Plugin\field\widget\AutocompleteWidgetBase.

Class

AutocompleteWidgetBase
Parent plugin for entity-reference autocomplete widgets.

Namespace

Drupal\entityreference\Plugin\field\widget

Code

public function formElement(array $items, $delta, array $element, $langcode, array &$form, array &$form_state) {
  $element = $this
    ->prepareElement($items, $delta, $element, $langcode, $form, $form_state, 'entityreference/autocomplete/single');
  return array(
    'target_id' => $element,
  );
}