function BlockLibraryController::buildLocalActions

Same name in other branches
  1. 9 core/modules/block/src/Controller/BlockLibraryController.php \Drupal\block\Controller\BlockLibraryController::buildLocalActions()
  2. 8.9.x core/modules/block/src/Controller/BlockLibraryController.php \Drupal\block\Controller\BlockLibraryController::buildLocalActions()
  3. 10 core/modules/block/src/Controller/BlockLibraryController.php \Drupal\block\Controller\BlockLibraryController::buildLocalActions()

Builds the local actions for this listing.

Return value

array An array of local actions for this listing.

1 call to BlockLibraryController::buildLocalActions()
BlockLibraryController::listBlocks in core/modules/block/src/Controller/BlockLibraryController.php
Shows a list of blocks that can be added to a theme's layout.

File

core/modules/block/src/Controller/BlockLibraryController.php, line 188

Class

BlockLibraryController
Provides a list of block plugins to be added to the layout.

Namespace

Drupal\block\Controller

Code

protected function buildLocalActions() {
    $build = $this->localActionManager
        ->getActionsForRoute($this->routeMatch
        ->getRouteName());
    // Without this workaround, the action links will be rendered as <li> with
    // no wrapping <ul> element.
    if (!empty($build)) {
        $build['#prefix'] = '<ul class="action-links">';
        $build['#suffix'] = '</ul>';
    }
    return $build;
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.