Loading src/Entity/Form/GroupMembershipApproveForm.php +5 −15 Original line number Diff line number Diff line Loading @@ -59,20 +59,10 @@ class GroupMembershipApproveForm extends ContentEntityConfirmFormBase { $container->get('entity_type.bundle.info'), $container->get('datetime.time'), $container->get('grequest.membership_request_manager'), $container->get('logger.factory')->get('group_content') $container->get('logger.factory')->get('group_relation') ); } /** * Returns the plugin responsible for this piece of group content. * * @return \Drupal\group\Plugin\GroupContentEnablerInterface * The responsible group content enabler plugin. */ protected function getContentPlugin() { return $this->getEntity()->getContentPlugin(); } /** * {@inheritdoc} */ Loading Loading @@ -124,13 +114,13 @@ class GroupMembershipApproveForm extends ContentEntityConfirmFormBase { * {@inheritdoc} */ public function submitForm(array &$form, FormStateInterface $form_state) { $group_content = $this->getEntity(); $group_relation = $this->getEntity(); $group_roles = []; $form_roles_values = $form_state->getValue('roles'); if (!empty($form_roles_values)) { $group_roles = array_filter(array_values($form_roles_values)); } $result = $this->membershipRequestManager->approve($group_content, $group_roles); $result = $this->membershipRequestManager->approve($group_relation, $group_roles); if ($result) { $this->messenger()->addStatus($this->t('Membership request approved')); Loading @@ -140,8 +130,8 @@ class GroupMembershipApproveForm extends ContentEntityConfirmFormBase { } $this->logger->notice('@type: approved %title.', [ '@type' => $group_content->bundle(), '%title' => $group_content->label(), '@type' => $group_relation->bundle(), '%title' => $group_relation->label(), ]); $form_state->setRedirectUrl($this->getCancelUrl()); Loading Loading
src/Entity/Form/GroupMembershipApproveForm.php +5 −15 Original line number Diff line number Diff line Loading @@ -59,20 +59,10 @@ class GroupMembershipApproveForm extends ContentEntityConfirmFormBase { $container->get('entity_type.bundle.info'), $container->get('datetime.time'), $container->get('grequest.membership_request_manager'), $container->get('logger.factory')->get('group_content') $container->get('logger.factory')->get('group_relation') ); } /** * Returns the plugin responsible for this piece of group content. * * @return \Drupal\group\Plugin\GroupContentEnablerInterface * The responsible group content enabler plugin. */ protected function getContentPlugin() { return $this->getEntity()->getContentPlugin(); } /** * {@inheritdoc} */ Loading Loading @@ -124,13 +114,13 @@ class GroupMembershipApproveForm extends ContentEntityConfirmFormBase { * {@inheritdoc} */ public function submitForm(array &$form, FormStateInterface $form_state) { $group_content = $this->getEntity(); $group_relation = $this->getEntity(); $group_roles = []; $form_roles_values = $form_state->getValue('roles'); if (!empty($form_roles_values)) { $group_roles = array_filter(array_values($form_roles_values)); } $result = $this->membershipRequestManager->approve($group_content, $group_roles); $result = $this->membershipRequestManager->approve($group_relation, $group_roles); if ($result) { $this->messenger()->addStatus($this->t('Membership request approved')); Loading @@ -140,8 +130,8 @@ class GroupMembershipApproveForm extends ContentEntityConfirmFormBase { } $this->logger->notice('@type: approved %title.', [ '@type' => $group_content->bundle(), '%title' => $group_content->label(), '@type' => $group_relation->bundle(), '%title' => $group_relation->label(), ]); $form_state->setRedirectUrl($this->getCancelUrl()); Loading