You are here

public function BlockController::performOperation in Drupal 8

Same name and namespace in other branches
  1. 9 core/modules/block/src/Controller/BlockController.php \Drupal\block\Controller\BlockController::performOperation()

Calls a method on a block and reloads the listing page.

Parameters

\Drupal\block\BlockInterface $block: The block being acted upon.

string $op: The operation to perform, e.g., 'enable' or 'disable'.

Return value

\Symfony\Component\HttpFoundation\RedirectResponse A redirect back to the listing page.

1 string reference to 'BlockController::performOperation'
block.routing.yml in core/modules/block/block.routing.yml
core/modules/block/block.routing.yml

File

core/modules/block/src/Controller/BlockController.php, line 54

Class

BlockController
Controller routines for admin block routes.

Namespace

Drupal\block\Controller

Code

public function performOperation(BlockInterface $block, $op) {
  $block
    ->{$op}()
    ->save();
  $this
    ->messenger()
    ->addStatus($this
    ->t('The block settings have been updated.'));
  return $this
    ->redirect('block.admin_display');
}