You are here

public function ContextReactionBlocksController::blocksFormThemeSelect in Context 8.4

Same name and namespace in other branches
  1. 8 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

\Symfony\Component\HttpFoundation\Request $request: The current request.

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

Return value

\Drupal\Core\Ajax\AjaxResponse The ajax response.

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 204

Class

ContextReactionBlocksController
The controller for the Block Context Reaction.

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;
}