You are here

private function RocketChatChannelBlock::retrieveGroupFromPath in Rocket.Chat 8.2

Retrieves the current group based on the loaded path.

Return value

\Drupal\group\Entity\Group

Throws

InvalidPluginDefinitionException

PluginNotFoundException

1 call to RocketChatChannelBlock::retrieveGroupFromPath()
RocketChatChannelBlock::build in modules/rocket_chat_group/src/Plugin/Block/RocketChatChannelBlock.php

File

modules/rocket_chat_group/src/Plugin/Block/RocketChatChannelBlock.php, line 128

Class

RocketChatChannelBlock
Provides an example block.

Namespace

Drupal\rocket_chat_group\Plugin\Block

Code

private function retrieveGroupFromPath() {
  $current_path = $this->currentPath
    ->getPath();
  $paths = explode("/", $current_path, 4);

  /** @var \Drupal\group\Entity\Group $groupEntity */
  $groupEntity = $this->entityTypeManager
    ->getStorage('group')
    ->load($paths[2]);
  return $groupEntity;
}