You are here

protected function BlockLibraryController::buildLocalActions in Drupal 8

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