You are here

protected function Group::getGroup in Organic groups 8

Returns the group that is relevant in the current context.

Return value

\Drupal\Core\Entity\ContentEntityInterface|null The group, or NULL if no group is found.

2 calls to Group::getGroup()
Group::getArgument in src/Plugin/views/argument_default/Group.php
Return the default argument.
Group::getCacheTags in src/Plugin/views/argument_default/Group.php
The cache tags associated with this object.

File

src/Plugin/views/argument_default/Group.php, line 122

Class

Group
Default argument plugin to provide the group from the current context.

Namespace

Drupal\og\Plugin\views\argument_default

Code

protected function getGroup() {
  $contexts = $this->ogContext
    ->getRuntimeContexts([
    'og',
  ]);
  if (!empty($contexts['og']) && ($group = $contexts['og']
    ->getContextValue())) {
    if ($group instanceof ContentEntityInterface) {
      return $group;
    }
  }
}