RouteBuilder.php in JSON-RPC 8
File
modules/jsonrpc_core/src/Plugin/jsonrpc/Method/RouteBuilder.php
View source
<?php
namespace Drupal\jsonrpc_core\Plugin\jsonrpc\Method;
use Drupal\Core\Routing\RouteBuilderInterface;
use Drupal\jsonrpc\Object\ParameterBag;
use Drupal\jsonrpc\Plugin\JsonRpcMethodBase;
use Symfony\Component\DependencyInjection\ContainerInterface;
class RouteBuilder extends JsonRpcMethodBase {
protected $routeBuilder;
public function __construct(array $configuration, string $plugin_id, $plugin_definition, RouteBuilderInterface $route_builder) {
parent::__construct($configuration, $plugin_id, $plugin_definition);
$this->routeBuilder = $route_builder;
}
public static function create(ContainerInterface $container, array $configuration, $plugin_id, $plugin_definition) {
return new static($configuration, $plugin_id, $plugin_definition, $container
->get('router.builder'));
}
public function execute(ParameterBag $params) {
return $this->routeBuilder
->rebuild();
}
public static function outputSchema() {
return NULL;
}
}