Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- namespace Drupaldemo_module_dymPluginWebFormHandler;
- use DrupalCoreFormFormStateInterface;
- use DrupalwebformPluginWebformHandlerBase;
- use DrupalwebformWebformSubmissionInterface;
- /**
- * Form submission handler.
- *
- * @WebformHandler(
- * id = "demo_module_dym_registration_submission_handler",
- * label = @Translation("Registration form handler"),
- * category = @Translation("API"),
- * description = @Translation("Set User Information on hidden field before submit form."),
- * cardinality = DrupalwebformPluginWebformHandlerInterface::CARDINALITY_SINGLE,
- * results = DrupalwebformPluginWebformHandlerInterface::RESULTS_PROCESSED,
- * )
- */
- class RegistrationFormHandler extends WebformHandlerBase {
- public function preprocessConfirmation(array &$variables) {
- parent::preprocessConfirmation($variables); // TODO: Change the autogenerated stub
- }
- public function submitForm(array &$form, FormStateInterface $form_state, WebformSubmissionInterface $webform_submission) {
- if (Drupal::currentUser()->isAnonymous()){
- $memberid = $form_state->getTemporaryValue('memberid');
- if (isset($memberid)){
- $webform_submission->setElementData('memberid', $memberid);
- }
- }
- parent::submitForm($form, $form_state, $webform_submission); // TODO: Change the autogenerated stub
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement