Skip to main content
Drupal API
User account menu
  • Log in

Breadcrumb

  1. Drupal Core 11.1.x
  2. BlockController.php

function 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\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');
}

API Navigation

  • Drupal Core 11.1.x
  • Topics
  • Classes
  • Functions
  • Constants
  • Globals
  • Files
  • Namespaces
  • Deprecated
  • Services
RSS feed
Powered by Drupal