public function Plugins::execute in JSON-RPC 8
Same name and namespace in other branches
- 2.x modules/jsonrpc_core/src/Plugin/jsonrpc/Method/Plugins.php \Drupal\jsonrpc_core\Plugin\jsonrpc\Method\Plugins::execute()
Throws
\Drupal\jsonrpc\Exception\JsonRpcException
Overrides ExecutableWithParamsInterface::execute
File
- modules/
jsonrpc_core/ src/ Plugin/ jsonrpc/ Method/ Plugins.php, line 80
Class
- Plugins
- Lists the plugin definitions of a given type.
Namespace
Drupal\jsonrpc_core\Plugin\jsonrpc\MethodCode
public function execute(ParameterBag $params) {
$pager = $params
->get('page');
$definitions = $this->pluginManager
->getDefinitions();
foreach ($definitions as $definition) {
if (!is_array($definition)) {
throw JsonRpcException::fromError(Error::invalidParams('Object-based plugin definitions are not yet supported.'));
}
}
if (!$pager) {
return $definitions;
}
return array_slice($definitions, $pager['offset'], $pager['limit']);
}