You are here

public function TempStoreController::set in Bootstrap Styles 1.0.x

Set a tempStore value by key.

Parameters

\Symfony\Component\HttpFoundation\Request $request: The request of the page.

Return value

\Symfony\Component\HttpFoundation\JsonResponse The JSON response.

1 string reference to 'TempStoreController::set'
bootstrap_styles.routing.yml in ./bootstrap_styles.routing.yml
bootstrap_styles.routing.yml

File

src/Controller/TempStoreController.php, line 51

Class

TempStoreController
Set or get any value to bootstrap_styles temp store.

Namespace

Drupal\bootstrap_styles\Controller

Code

public function set(Request $request) {
  $key = $request->request
    ->get('key');
  $value = $request->request
    ->get('value');
  $this->tempStore
    ->set($key, $value);

  // Return an empty JSON response.
  return new JsonResponse();
}