You are here

public function JsonRpcMethodManager::alterDefinitions in JSON-RPC 8

Same name and namespace in other branches
  1. 2.x src/Plugin/JsonRpcMethodManager.php \Drupal\jsonrpc\Plugin\JsonRpcMethodManager::alterDefinitions()

Invokes the hook to alter the definitions if the alter hook is set.

Parameters

$definitions: The discovered plugin definitions.

Overrides DefaultPluginManager::alterDefinitions

File

src/Plugin/JsonRpcMethodManager.php, line 40

Class

JsonRpcMethodManager
Provides the JsonRpcMethod plugin plugin manager.

Namespace

Drupal\jsonrpc\Plugin

Code

public function alterDefinitions(&$definitions) {

  /* @var \Drupal\jsonrpc\Annotation\JsonRpcMethod $method */
  foreach ($definitions as &$method) {
    $this
      ->assertValidJsonRpcMethodPlugin($method);
    if (isset($method->params)) {
      foreach ($method->params as $key => &$param) {
        $param
          ->setId($key);
      }
    }
  }
  parent::alterDefinitions($definitions);
}