You are here

public static function Select2EntityReferenceWidget::create in Select 2 8

Creates an instance of the plugin.

Parameters

\Symfony\Component\DependencyInjection\ContainerInterface $container: The container to pull out services used in the plugin.

array $configuration: A configuration array containing information about the plugin instance.

string $plugin_id: The plugin ID for the plugin instance.

mixed $plugin_definition: The plugin implementation definition.

Return value

static Returns an instance of this plugin.

Overrides WidgetBase::create

File

src/Plugin/Field/FieldWidget/Select2EntityReferenceWidget.php, line 41

Class

Select2EntityReferenceWidget
Plugin implementation of the 'select2' widget.

Namespace

Drupal\select2\Plugin\Field\FieldWidget

Code

public static function create(ContainerInterface $container, array $configuration, $plugin_id, $plugin_definition) {
  $widget = parent::create($container, $configuration, $plugin_id, $plugin_definition);
  $widget
    ->setEntityTypeManager($container
    ->get('entity_type.manager'));
  return $widget;
}