I am using drupal 8 and webform 8.x-5.0-beta25
. I have a multistep form with ajax enabled, 5 pages.
I need to alter the confirmation message but I haven't been able to figure it out. What I want to achieve is change the message depending on some form values the selected on the last question. I've created a custom module and extended the WebformHandlerBase
and created a confirmForm
function but I am not seeing anything once the form is submitted.
Again, it is submitting through ajax so I am not sure if that has anything to do with it.
Here is what I have tried so far
/modules/custom/cbed_ux/src/Plugin/WebformHandler/QuizWebformHandler.php
<?php
namespace Drupal\cbed_ux\Plugin\WebformHandler;
use Drupal\Core\Form\FormStateInterface;
use Drupal\webform\WebformHandlerBase;
use Drupal\webform\WebformSubmissionInterface;
use Drupal\webform\WebformInterface;
/**
* Form confirm handler.
*
* @WebformHandler(
* id = "quiz_handler",
* label = @Translation("Quiz Handler"),
* category = @Translation("Quiz Handler"),
* description = @Translation("Quiz Webform handler."),
* cardinality = \Drupal\webform\WebformHandlerInterface::CARDINALITY_UNLIMITED,
* results = \Drupal\webform\WebformHandlerInterface::RESULTS_PROCESSED,
* )
*/
class QuizWebformHandler extends WebformHandlerBase {
public function confirmForm(array &$form, FormStateInterface $form_state, WebformSubmissionInterface $webform_submission) {
kint($webform_submission);
drupal_set_message ('submitted!!');
}
}
The form submits, but I do not see my kint or set message