You are here

public static function QueryStringWebformSourceEntity::create in Webform 6.x

Same name and namespace in other branches
  1. 8.5 src/Plugin/WebformSourceEntity/QueryStringWebformSourceEntity.php \Drupal\webform\Plugin\WebformSourceEntity\QueryStringWebformSourceEntity::create()

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 WebformSourceEntityBase::create

1 call to QueryStringWebformSourceEntity::create()
QueryStringWebformSourceEntityTest::testGetCurrentSourceEntity in tests/src/Unit/Plugin/WebformSourceEntity/QueryStringWebformSourceEntityTest.php
Tests detection of source entity via query string.

File

src/Plugin/WebformSourceEntity/QueryStringWebformSourceEntity.php, line 59

Class

QueryStringWebformSourceEntity
Detect source entity by examining query string.

Namespace

Drupal\webform\Plugin\WebformSourceEntity

Code

public static function create(ContainerInterface $container, array $configuration, $plugin_id, $plugin_definition) {
  $instance = parent::create($container, $configuration, $plugin_id, $plugin_definition);
  $instance->entityTypeManager = $container
    ->get('entity_type.manager');
  $instance->routeMatch = $container
    ->get('current_route_match');
  $instance->request = $container
    ->get('request_stack')
    ->getCurrentRequest();
  $instance->languageManager = $container
    ->get('language_manager');
  $instance->webformEntityReferenceManager = $container
    ->get('webform.entity_reference_manager');
  return $instance;
}