You are here

public function ContextReactionBlocksController::blocksFormThemeSelect in Context 8

Same name and namespace in other branches
  1. 8.4 src/Reaction/Blocks/Controller/ContextReactionBlocksController.php \Drupal\context\Reaction\Blocks\Controller\ContextReactionBlocksController::blocksFormThemeSelect()
  2. 8.0 src/Reaction/Blocks/Controller/ContextReactionBlocksController.php \Drupal\context\Reaction\Blocks\Controller\ContextReactionBlocksController::blocksFormThemeSelect()

Callback for the theme select list on the Context blocks reaction form.

Parameters

Request $request: The current request.

ContextInterface $context: The context the block reaction is located on.

Return value

\Drupal\Core\Ajax\AjaxResponse

1 string reference to 'ContextReactionBlocksController::blocksFormThemeSelect'
context_ui.routing.yml in modules/context_ui/context_ui.routing.yml
modules/context_ui/context_ui.routing.yml

File

src/Reaction/Blocks/Controller/ContextReactionBlocksController.php, line 191

Class

ContextReactionBlocksController

Namespace

Drupal\context\Reaction\Blocks\Controller

Code

public function blocksFormThemeSelect(Request $request, ContextInterface $context) {
  $theme = $request->request
    ->get('reactions[blocks][theme]', '', TRUE);

  // Get the context form and supply it with the blocks theme value.
  $form = $this->contextManager
    ->getForm($context, 'edit', [
    'reactions' => [
      'blocks' => [
        'theme' => $theme,
      ],
    ],
  ]);
  $response = new AjaxResponse();
  $response
    ->addCommand(new ReplaceCommand('#context-reactions', $form['reactions']));
  return $response;
}