BlockLibraryGroupsController.php in Block Visibility Groups 8
File
src/Controller/BlockLibraryGroupsController.php
View source
<?php
namespace Drupal\block_visibility_groups\Controller;
use Drupal\block\Controller\BlockLibraryController;
use Drupal\block_visibility_groups\Entity\BlockVisibilityGroup;
use Symfony\Component\HttpFoundation\Request;
class BlockLibraryGroupsController extends BlockLibraryController {
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;
}
}