You are here

public function PluginSelectorBase::setSelectablePluginType in Plugin 8.2

Sets the selectable plugin type.

Parameters

\Drupal\plugin\PluginType\PluginTypeInterface $plugin_type: The type of which to select plugins.

Return value

$this

Overrides PluginSelectorInterface::setSelectablePluginType

File

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

Class

PluginSelectorBase
Provides a base plugin selector.

Namespace

Drupal\plugin\Plugin\Plugin\PluginSelector

Code

public function setSelectablePluginType(PluginTypeInterface $plugin_type) {
  $this->selectablePluginDiscovery = new TypedDefinitionEnsuringPluginDiscoveryDecorator($plugin_type);
  $this->selectablePluginFactory = $plugin_type
    ->getPluginManager();
  $this->selectablePluginType = $plugin_type;
  $default_plugin = $this->defaultPluginResolver
    ->createDefaultPluginInstance($plugin_type);
  if ($default_plugin) {
    $this
      ->setSelectedPlugin($default_plugin);
  }
  return $this;
}