public function InviteByEmailBlockForm::submitForm in Invite 8
Form submission handler.
Parameters
array $form: An associative array containing the structure of the form.
\Drupal\Core\Form\FormStateInterface $form_state: The current state of the form.
Overrides FormInterface::submitForm
File
- modules/
invite_by_email/ src/ Form/ InviteByEmailBlockForm.php, line 74
Class
- InviteByEmailBlockForm
- Class InviteByEmailBlockForm.
Namespace
Drupal\invite_by_email\FormCode
public function submitForm(array &$form, FormStateInterface $form_state) {
$invite_type = $form_state
->getBuildInfo()['args'][0];
$invite = Invite::create([
'type' => $invite_type,
]);
$invite->field_invite_email_address->value = $form_state
->getValue('email');
$subject = $form_state
->getValue('email_subject');
if (!empty($subject)) {
$invite->field_invite_email_subject->value = $subject;
}
$invite
->setPlugin('invite_by_email');
$invite
->save();
}