function BlockController::performOperation
Same name in other branches
- 9 core/modules/block/src/Controller/BlockController.php \Drupal\block\Controller\BlockController::performOperation()
- 8.9.x core/modules/block/src/Controller/BlockController.php \Drupal\block\Controller\BlockController::performOperation()
- 10 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 44
Class
- BlockController
- Controller routines for admin block routes.
Namespace
Drupal\block\ControllerCode
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');
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.