SHARE
TWEET

Untitled

a guest Mar 20th, 2019 54 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. namespace Drupaldemo_module_dymPluginWebFormHandler;
  2.  
  3.  
  4. use DrupalCoreFormFormStateInterface;
  5. use DrupalwebformPluginWebformHandlerBase;
  6. use DrupalwebformWebformSubmissionInterface;
  7.  
  8. /**
  9.  * Form submission handler.
  10.  *
  11.  * @WebformHandler(
  12.  *     id = "demo_module_dym_registration_submission_handler",
  13.  *     label = @Translation("Registration form handler"),
  14.  *     category = @Translation("API"),
  15.  *     description = @Translation("Set User Information on hidden field before submit form."),
  16.  *     cardinality = DrupalwebformPluginWebformHandlerInterface::CARDINALITY_SINGLE,
  17.  *     results = DrupalwebformPluginWebformHandlerInterface::RESULTS_PROCESSED,
  18.  * )
  19.  */
  20. class RegistrationFormHandler extends WebformHandlerBase {
  21.  
  22.  
  23.   public function preprocessConfirmation(array &$variables) {
  24.     parent::preprocessConfirmation($variables); // TODO: Change the autogenerated stub
  25.   }
  26.  
  27.   public function submitForm(array &$form, FormStateInterface $form_state, WebformSubmissionInterface $webform_submission) {
  28.  
  29.     if (Drupal::currentUser()->isAnonymous()){
  30.  
  31.       $memberid = $form_state->getTemporaryValue('memberid');
  32.  
  33.       if (isset($memberid)){
  34.         $webform_submission->setElementData('memberid', $memberid);
  35.       }
  36.  
  37.     }
  38.     parent::submitForm($form, $form_state, $webform_submission); // TODO: Change the autogenerated stub
  39.   }
  40.  
  41. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top