You are here

protected function BlockVisibilityGroupedListBuilder::getBlockVisibilityGroup in Block Visibility Groups 8

Get the Block Visibility Group for this page request.

Parameters

bool|false $groups_only: Should this function return only group key or also a constant value if no group.

Return value

string|null

1 call to BlockVisibilityGroupedListBuilder::getBlockVisibilityGroup()
BlockVisibilityGroupedListBuilder::buildBlocksForm in src/BlockVisibilityGroupedListBuilder.php
Builds the main "Blocks" portion of the form.

File

src/BlockVisibilityGroupedListBuilder.php, line 279

Class

BlockVisibilityGroupedListBuilder
Extends BlockListBuilder to add our elements only show certain blocks.

Namespace

Drupal\block_visibility_groups

Code

protected function getBlockVisibilityGroup($groups_only = FALSE) {
  $group = $this->request->query
    ->get('block_visibility_group');
  if ($groups_only && in_array($group, [
    $this::ALL_GROUP,
    $this::UNSET_GROUP,
  ])) {
    return NULL;
  }
  return $group;
}