You are here

public function FeatureContext::getGroupIdFromTitle in Open Social 8

Same name and namespace in other branches
  1. 8.2 tests/behat/features/bootstrap/FeatureContext.php \FeatureContext::getGroupIdFromTitle()

Parameters

$group_title:

Return value

null

2 calls to FeatureContext::getGroupIdFromTitle()
FeatureContext::iSelectGroup in tests/behat/features/bootstrap/FeatureContext.php
@When I select group :group
FeatureContext::openGroupStreamPage in tests/behat/features/bootstrap/FeatureContext.php
Opens group stream page.

File

tests/behat/features/bootstrap/FeatureContext.php, line 540

Class

FeatureContext
Defines application features from the specific context.

Code

public function getGroupIdFromTitle($group_title) {
  $query = \Drupal::entityQuery('group')
    ->condition('label', $group_title);
  $group_ids = $query
    ->execute();
  $groups = entity_load_multiple('group', $group_ids);
  if (count($groups) > 1) {
    return NULL;
  }
  else {
    $group = reset($groups);
    if ($group
      ->id() !== 0) {
      $group_id = $group
        ->id();
    }
  }
  return $group_id;
}