Loading src/MembershipRequestManager.php +7 −0 Original line number Diff line number Diff line Loading @@ -2,6 +2,7 @@ namespace Drupal\grequest; use Drupal\Component\Render\FormattableMarkup; use Drupal\Core\Entity\EntityTypeManagerInterface; use Drupal\Core\Session\AccountInterface; use Drupal\grequest\Plugin\GroupContentEnabler\GroupMembershipRequest; Loading Loading @@ -120,11 +121,17 @@ class MembershipRequestManager { * Transition approve | reject. */ public function updateStatus(GroupContentInterface $group_content, $transition_id) { if ($group_content->getContentPlugin()->getPluginId() != 'group_membership_request') { throw new \Exception('Only group content of "Group membership request" is allowed.'); } $state_item = $group_content->get(GroupMembershipRequest::STATUS_FIELD)->first(); if ($state_item->isTransitionAllowed($transition_id)) { $state_item->applyTransitionById($transition_id); $group_content->set('grequest_updated_by', $this->currentUser->id()); } else { throw new \Exception(new FormattableMarkup('Transition ":transition_id" is not allowed.', [':transition_id' => $transition_id])); } } /** Loading Loading
src/MembershipRequestManager.php +7 −0 Original line number Diff line number Diff line Loading @@ -2,6 +2,7 @@ namespace Drupal\grequest; use Drupal\Component\Render\FormattableMarkup; use Drupal\Core\Entity\EntityTypeManagerInterface; use Drupal\Core\Session\AccountInterface; use Drupal\grequest\Plugin\GroupContentEnabler\GroupMembershipRequest; Loading Loading @@ -120,11 +121,17 @@ class MembershipRequestManager { * Transition approve | reject. */ public function updateStatus(GroupContentInterface $group_content, $transition_id) { if ($group_content->getContentPlugin()->getPluginId() != 'group_membership_request') { throw new \Exception('Only group content of "Group membership request" is allowed.'); } $state_item = $group_content->get(GroupMembershipRequest::STATUS_FIELD)->first(); if ($state_item->isTransitionAllowed($transition_id)) { $state_item->applyTransitionById($transition_id); $group_content->set('grequest_updated_by', $this->currentUser->id()); } else { throw new \Exception(new FormattableMarkup('Transition ":transition_id" is not allowed.', [':transition_id' => $transition_id])); } } /** Loading