You are here

public function MaintenanceModeEnabled::execute in JSON-RPC 2.x

Same name and namespace in other branches
  1. 8 modules/jsonrpc_core/src/Plugin/jsonrpc/Method/MaintenanceModeEnabled.php \Drupal\jsonrpc_core\Plugin\jsonrpc\Method\MaintenanceModeEnabled::execute()

Executes the action with the parameters passed in.

Parameters

\Drupal\jsonrpc\Object\ParameterBag $params: The parameters.

Return value

mixed The result of the execution.

Overrides ExecutableWithParamsInterface::execute

File

modules/jsonrpc_core/src/Plugin/jsonrpc/Method/MaintenanceModeEnabled.php, line 74

Class

MaintenanceModeEnabled
RPC method to enable or disable maintenance mode.

Namespace

Drupal\jsonrpc_core\Plugin\jsonrpc\Method

Code

public function execute(ParameterBag $parameters) {
  $enabled = $parameters
    ->get('enabled');
  $this->state
    ->set('system.maintenance_mode', $enabled);
  return $this->state
    ->get('system.maintenance_mode') ? static::ENABLED : static::DISABLED;
}