public static function Plugins::create in JSON-RPC 2.x
Same name and namespace in other branches
- 8 modules/jsonrpc_core/src/Plugin/jsonrpc/Method/Plugins.php \Drupal\jsonrpc_core\Plugin\jsonrpc\Method\Plugins::create()
Creates a new Plugin.
Parameters
\Symfony\Component\DependencyInjection\ContainerInterface $container: The service container.
array $configuration: The configuration.
string $plugin_id: The plugin ID.
mixed $plugin_definition: The plugin definition.
Return value
\Drupal\jsonrpc_core\Plugin\jsonrpc\Method\Plugins The plugin method.
Overrides JsonRpcMethodBase::create
File
- modules/
jsonrpc_core/ src/ Plugin/ jsonrpc/ Method/ Plugins.php, line 62
Class
- Plugins
- Lists the plugin definitions of a given type.
Namespace
Drupal\jsonrpc_core\Plugin\jsonrpc\MethodCode
public static function create(ContainerInterface $container, array $configuration, $plugin_id, $plugin_definition) {
/* @var \Drupal\jsonrpc\Object\Request $request */
$request = $configuration[HandlerInterface::JSONRPC_REQUEST_KEY];
/* @var \Drupal\Component\Plugin\PluginManagerInterface $plugin_manager */
try {
$plugin_manager = $container
->get($request
->getParameter('service'));
} catch (ServiceNotFoundException $e) {
throw JsonRpcException::fromError(Error::invalidParams($e
->getMessage()));
}
return new static($configuration, $plugin_id, $plugin_definition, $plugin_manager);
}