Skip to content
Snippets Groups Projects

Added missing class, Issue #3318149: Add UI for grant role invitations

Merged Carsten Logemann requested to merge issue/grant-3318149:1.x into 1.x
Files
4
@@ -4,6 +4,7 @@ namespace Drupal\grant\Form;
use Drupal\Component\Utility\Html;
use Drupal\Core\Config\ConfigFactoryInterface;
use Drupal\Core\Entity\ContentEntityInterface;
use Drupal\Core\Entity\EntityTypeManagerInterface;
use Drupal\Core\Form\FormBase;
use Drupal\Core\Form\FormStateInterface;
@@ -178,26 +179,16 @@ class GrantInviteForm extends FormBase {
*/
public function submitForm(array &$form, FormStateInterface $form_state) {
$parameter = $form_state->getStorage();
$form_values = $form_state->getValues();
$uid = $this->account->id();
$current_user = $this->entityTypeManager->getStorage('user')->load($uid);
$current_user_uuid = $current_user->uuid();
$e_values = [
'status' => 0,
'role' => $form_values['role'],
'note' => trim($form_values['note']),
'user' => $current_user_uuid,
'email' => trim($form_values['email']),
'entity_type' => $parameter['entity_type'],
'entity_uuid' => $parameter['entity_uuid'],
'timer' => 1,
];
$grant = Grant::create($e_values);
$values = $form_state->getValues();
$values['entity_type'] = $parameter['entity_type'];
$values['entity_uuid'] = $parameter['entity_uuid'];
$grant = $this->grantMain->addGrant($values);
$grant->save();
// @todo: Ceck new grant entity for success and modify message if auto create.
$this->messenger()->addStatus($this->t('The grant invitation has been saved.'));
$form_state->setRedirect('<front>');
// @todo: Make redirect configurable.
// $form_state->setRedirect('<front>');
}
}
Loading