public function BlockLibraryGroupsController::listBlocks in Block Visibility Groups 8
Shows a list of blocks that can be added to a theme's layout.
Parameters
\Symfony\Component\HttpFoundation\Request $request: The current request.
string $theme: Theme key of the block list.
Return value
array A render array as expected by the renderer.
Overrides BlockLibraryController::listBlocks
1 string reference to 'BlockLibraryGroupsController::listBlocks'
File
- src/
Controller/ BlockLibraryGroupsController.php, line 17
Class
- BlockLibraryGroupsController
- Provides a list of block plugins to be added to the layout.
Namespace
Drupal\block_visibility_groups\ControllerCode
public function listBlocks(Request $request, $theme, BlockVisibilityGroup $block_visibility_group = NULL) {
$list = parent::listBlocks($request, $theme);
if ($block_visibility_group) {
foreach ($list['blocks']['#rows'] as &$row) {
$row['operations']['data']['#links']['add']['query']['block_visibility_group'] = $block_visibility_group
->id();
}
}
return $list;
}