You are here

public function GroupHierarchyManager::groupHasSubgroup in Subgroup (Graph) 1.0.x

Checks if a group has a subgroup anywhere in its descendents.

Parameters

\Drupal\group\Entity\GroupInterface $group: The parent group whose subgroups will be checked.

\Drupal\group\Entity\GroupInterface $subgroup: The subgroup that will be searched for within the parent group's subgroups.

Return value

bool TRUE if the given group has the given subgroup, or FALSE if not.

Overrides GroupHierarchyManagerInterface::groupHasSubgroup

File

src/GroupHierarchyManager.php, line 109

Class

GroupHierarchyManager
Manages the relationship between groups (as subgroups).

Namespace

Drupal\ggroup

Code

public function groupHasSubgroup(GroupInterface $group, GroupInterface $subgroup) {
  return $this->groupGraphStorage
    ->isDescendant($subgroup
    ->id(), $group
    ->id());
}