public function GroupInfo::getActiveGroups in Block Visibility Groups 8
Get all active groups.
Return value
\Drupal\block_visibility_groups\Entity\BlockVisibilityGroup[]
File
- block_visibility_groups_admin/
src/ GroupInfo.php, line 52
Class
- GroupInfo
- Class GroupInfo.
Namespace
Drupal\block_visibility_groups_adminCode
public function getActiveGroups() {
$active_groups = [];
/** @var BlockVisibilityGroup $group */
foreach ($this->group_storage
->loadMultiple() as $id => $group) {
/** @var \Drupal\block_visibility_groups\Plugin\Condition\ConditionGroup $condition ; */
$condition = $this->condition_manager
->createInstance('condition_group', [
'block_visibility_group' => $id,
]);
if ($condition
->evaluate()) {
$active_groups[$id] = $group;
}
}
return $active_groups;
}