You are here

public function PluginSelectorBase::setSelectedPlugin in Plugin 8.2

Sets the selected plugin.

Parameters

\Drupal\Component\Plugin\PluginInspectionInterface $plugin:

Return value

$this

Overrides PluginSelectorInterface::setSelectedPlugin

3 calls to PluginSelectorBase::setSelectedPlugin()
AdvancedPluginSelectorBase::buildOneAvailablePlugin in src/Plugin/Plugin/PluginSelector/AdvancedPluginSelectorBase.php
Builds the form elements for one plugin.
AdvancedPluginSelectorBase::validateSelectorForm in src/Plugin/Plugin/PluginSelector/AdvancedPluginSelectorBase.php
Validates the selector form.
PluginSelectorBase::setSelectablePluginType in src/Plugin/Plugin/PluginSelector/PluginSelectorBase.php
Sets the selectable plugin type.

File

src/Plugin/Plugin/PluginSelector/PluginSelectorBase.php, line 237

Class

PluginSelectorBase
Provides a base plugin selector.

Namespace

Drupal\plugin\Plugin\Plugin\PluginSelector

Code

public function setSelectedPlugin(PluginInspectionInterface $plugin) {
  $this
    ->validateSelectablePluginType();
  $this->selectedPlugin = $plugin;
  if ($this
    ->getKeepPreviouslySelectedPlugins()) {
    $this->previouslySelectedPlugins[$plugin
      ->getPluginId()] = $plugin;
  }
  return $this;
}