You are here

public function GroupIdFromUrl::__construct in Group 8

Same name and namespace in other branches
  1. 2.0.x src/Plugin/views/argument_default/GroupIdFromUrl.php \Drupal\group\Plugin\views\argument_default\GroupIdFromUrl::__construct()

Constructs a new GroupIdFromUrl instance.

Parameters

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.

\Drupal\Core\Plugin\Context\ContextProviderInterface $context_provider: The group route context.

Overrides PluginBase::__construct

File

src/Plugin/views/argument_default/GroupIdFromUrl.php, line 40

Class

GroupIdFromUrl
Default argument plugin to extract a group ID.

Namespace

Drupal\group\Plugin\views\argument_default

Code

public function __construct(array $configuration, $plugin_id, $plugin_definition, ContextProviderInterface $context_provider) {
  parent::__construct($configuration, $plugin_id, $plugin_definition);

  /** @var \Drupal\Core\Plugin\Context\ContextInterface[] $contexts */
  $contexts = $context_provider
    ->getRuntimeContexts([
    'group',
  ]);
  $this->group = $contexts['group']
    ->getContextValue();
}