You are here

public function PluginTypeManager::getPluginType in Plugin 8.2

Gets a known plugin type.

Parameters

string $id: The plugin type's ID.

Return value

\Drupal\plugin\PluginType\PluginTypeInterface

Throws

\InvalidArgumentException Thrown if the plugin type is unknown.

Overrides PluginTypeManagerInterface::getPluginType

File

src/PluginType/PluginTypeManager.php, line 62

Class

PluginTypeManager
Provides a plugin type manager.

Namespace

Drupal\plugin\PluginType

Code

public function getPluginType($id) {
  $plugin_types = $this
    ->getPluginTypes();
  if (isset($plugin_types[$id])) {
    return $plugin_types[$id];
  }
  else {
    throw new \InvalidArgumentException(sprintf('Plugin type "%s" is unknown.', $id));
  }
}