The under hyperlink will open the webform (contact) in a dialog:
<a href="/kind/contact" class="btn btn-success webform-dialog webform-dialog-normal">Contact</a>
this similar hyperlink has been positioned on many pages in my Drupal eight web site.
After the Webform is submitted, I need to know the url of the web page from the place the Webform has been loaded.
So say the above hyperlink is positioned on the web page of url:
/my-hobbies, when a consumer will load the Webform from this web page and submit it, I need to Programmatically know that the webform has been submitted from this url:
In a CustomHandler, I’ve tried:
$current_path = Drupal::service('path.present')->getPath(); Drupal::messenger()->addMessage(t("This webform has been loaded from this url: $current_path"));
however the above code returned the trail of the webform itself.
is that this even potential in php ?
The primary thought behind figuring out the present url of the web page is as a result of after the webform is submitted, i need to refresh the web page from the place the Webform is loaded and I’m doing the refresh by redirecting the consumer to the identical web page url.
I’m utilizing under code to robotically shut the Webform and redirect the consumer:
// Redirect the consumer utilizing "Ajax Response". // @See: https://www.drupal.org/mission/webform/points/3002966 $response = new DrupalCoreAjaxAjaxResponse(); $response->addCommand(new DrupalCoreAjaxRedirectCommand('/dwelling')); $form_state->setResponse($response);