You are here

public function DefaultTwigExtension::is_member in Opigno training catalog 8

Same name and namespace in other branches
  1. 3.x src/TwigExtension/DefaultTwigExtension.php \Drupal\opigno_catalog\TwigExtension\DefaultTwigExtension::is_member()

Checks if user is a member of group.

File

src/TwigExtension/DefaultTwigExtension.php, line 56

Class

DefaultTwigExtension
Class DefaultTwigExtension.

Namespace

Drupal\opigno_catalog\TwigExtension

Code

public function is_member($group_id) {
  $group = Group::load($group_id);
  $account = \Drupal::currentUser();
  return (bool) $group
    ->getMember($account);
}