You are here

interface GroupMembershipLoaderInterface in Group 8

Same name and namespace in other branches
  1. 2.0.x src/GroupMembershipLoaderInterface.php \Drupal\group\GroupMembershipLoaderInterface

Defines the group membership loader interface.

Hierarchy

Expanded class hierarchy of GroupMembershipLoaderInterface

All classes that implement GroupMembershipLoaderInterface

4 files declare their use of GroupMembershipLoaderInterface
DefaultGroupPermissionCalculator.php in src/Access/DefaultGroupPermissionCalculator.php
GroupRoleStorage.php in src/Entity/Storage/GroupRoleStorage.php
IsGroupMemberCacheContext.php in src/Cache/Context/IsGroupMemberCacheContext.php
IsGroupMemberCacheContextTest.php in tests/src/Unit/IsGroupMemberCacheContextTest.php

File

src/GroupMembershipLoaderInterface.php, line 11

Namespace

Drupal\group
View source
interface GroupMembershipLoaderInterface {

  /**
   * Loads a membership by group and user.
   *
   * @param \Drupal\group\Entity\GroupInterface $group
   *   The group to load the membership from.
   * @param \Drupal\Core\Session\AccountInterface $account
   *   The user to load the membership for.
   *
   * @return \Drupal\group\GroupMembership|false
   *   The loaded GroupMembership or FALSE if none was found.
   */
  public function load(GroupInterface $group, AccountInterface $account);

  /**
   * Loads all memberships for a group.
   *
   * @param \Drupal\group\Entity\GroupInterface $group
   *   The group to load the memberships from.
   * @param string|array $roles
   *   (optional) A group role machine name or a list of group role machine
   *   names to filter on. Valid results only need to match on one role.
   *
   * @return \Drupal\group\GroupMembership[]
   *   The loaded GroupMemberships matching the criteria.
   */
  public function loadByGroup(GroupInterface $group, $roles = NULL);

  /**
   * Loads all memberships for a user.
   *
   * @param \Drupal\Core\Session\AccountInterface $account
   *   (optional) The user to load the membership for. Leave blank to load the
   *   memberships of the currently logged in user.
   * @param string|array $roles
   *   (optional) A group role machine name or a list of group role machine
   *   names to filter on. Valid results only need to match on one role.
   *
   * @return \Drupal\group\GroupMembership[]
   *   The loaded GroupMemberships matching the criteria.
   */
  public function loadByUser(AccountInterface $account = NULL, $roles = NULL);

}

Members

Namesort descending Modifiers Type Description Overrides
GroupMembershipLoaderInterface::load public function Loads a membership by group and user. 1
GroupMembershipLoaderInterface::loadByGroup public function Loads all memberships for a group. 1
GroupMembershipLoaderInterface::loadByUser public function Loads all memberships for a user. 1