Skip to content
This repository has been archived by the owner on Aug 18, 2024. It is now read-only.

Commit

Permalink
Rename the constant to
Browse files Browse the repository at this point in the history
  • Loading branch information
pfrenssen committed Dec 12, 2018
1 parent dc20d01 commit 2422e01
Show file tree
Hide file tree
Showing 7 changed files with 9 additions and 9 deletions.
2 changes: 1 addition & 1 deletion og.module
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ function og_entity_insert(EntityInterface $entity) {

// Other modules that implement hook_entity_insert() might already have
// created a membership ahead of us.
if (!Og::getMembership($entity, $entity->getOwner(), OgMembershipInterface::STATES)) {
if (!Og::getMembership($entity, $entity->getOwner(), OgMembershipInterface::ALL_STATES)) {
$membership = Og::createMembership($entity, $entity->getOwner());
$membership->save();
}
Expand Down
2 changes: 1 addition & 1 deletion src/Cache/Context/OgMembershipStateCacheContext.php
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ public function getContext() {
}

/** @var \Drupal\og\OgMembershipInterface $membership */
$membership = $this->membershipManager->getMembership($group, $this->user, OgMembershipInterface::STATES);
$membership = $this->membershipManager->getMembership($group, $this->user, OgMembershipInterface::ALL_STATES);
return $membership ? $membership->getState() : self::NO_CONTEXT;
}

Expand Down
2 changes: 1 addition & 1 deletion src/Controller/SubscriptionController.php
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ public function subscribe($entity_type_id, EntityInterface $group, OgMembershipT
public function unsubscribe(ContentEntityInterface $group) {
$user = $this->currentUser();

if (!$membership = Og::getMembership($group, $user, OgMembershipInterface::STATES)) {
if (!$membership = Og::getMembership($group, $user, OgMembershipInterface::ALL_STATES)) {
// User is not a member.
throw new AccessDeniedHttpException();
}
Expand Down
2 changes: 1 addition & 1 deletion src/MembershipManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ public function getUserGroups(AccountInterface $user, array $states = [OgMembers
public function getMemberships(AccountInterface $user, array $states = [OgMembershipInterface::STATE_ACTIVE]) {
// When an empty array is passed, retrieve memberships with all possible
// states.
$states = $states ?: OgMembership::STATES;
$states = $states ?: OgMembership::ALL_STATES;

// Get a string identifier of the states, so we can retrieve it from cache.
sort($states);
Expand Down
4 changes: 2 additions & 2 deletions src/MembershipManagerInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ public function getUserGroups(AccountInterface $user, array $states = [OgMembers
* @param array $states
* (optional) Array with the states to return. Defaults to only returning
* active memberships. In order to retrieve all memberships regardless of
* state, pass `OgMembershipInterface::STATES`.
* state, pass `OgMembershipInterface::ALL_STATES`.
*
* @return \Drupal\og\OgMembershipInterface[]
* An array of OgMembership entities, keyed by ID.
Expand All @@ -80,7 +80,7 @@ public function getMemberships(AccountInterface $user, array $states = [OgMember
* @param array $states
* (optional) Array with the states to return. Defaults to only returning
* active memberships. In order to retrieve all memberships regardless of
* state, pass `OgMembershipInterface::STATES`.
* state, pass `OgMembershipInterface::ALL_STATES`.
*
* @return \Drupal\og\OgMembershipInterface|null
* The OgMembership entity. NULL will be returned if no membership is
Expand Down
4 changes: 2 additions & 2 deletions src/Og.php
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ public static function createField($plugin_id, $entity_type, $bundle, array $set
* @param array $states
* (optional) Array with the states to return. Defaults to only returning
* active memberships. In order to retrieve all memberships regardless of
* state, pass `OgMembershipInterface::STATES`.
* state, pass `OgMembershipInterface::ALL_STATES`.
*
* @return \Drupal\og\OgMembershipInterface[]
* An array of OgMembership entities, keyed by ID.
Expand All @@ -156,7 +156,7 @@ public static function getMemberships(AccountInterface $user, array $states = [O
* @param array $states
* (optional) Array with the states to return. Defaults to only returning
* active memberships. In order to retrieve all memberships regardless of
* state, pass `OgMembershipInterface::STATES`.
* state, pass `OgMembershipInterface::ALL_STATES`.
*
* @return \Drupal\og\OgMembershipInterface|null
* The OgMembership entity. NULL will be returned if no membership is
Expand Down
2 changes: 1 addition & 1 deletion src/OgMembershipInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ interface OgMembershipInterface extends ContentEntityInterface, EntityOwnerInter
/**
* An array containing all possible group membership states.
*/
const STATES = [self::STATE_ACTIVE, self::STATE_PENDING, self::STATE_BLOCKED];
const ALL_STATES = [self::STATE_ACTIVE, self::STATE_PENDING, self::STATE_BLOCKED];

/**
* The default group membership type that is the bundle of group membership.
Expand Down

0 comments on commit 2422e01

Please sign in to comment.