I’m trying to create a custom webform handler. I’d like to be able to attach my handler to any webform and have it display the message ‘xyz’ when the (multi step wizard) form is finally submitted. I have this file in my custom module at: my_module/src/Plugin/WebformHandler/PostWebformHandler.php
.
<?php namespace Drupaltest_bPluginWebformHandler; use DrupalwebformPluginWebformHandlerBase; use DrupalwebformWebformSubmissionInterface; /** * Webform test b handler. * * @WebformHandler( * id = "test_b", * label = @Translation("Test B"), * category = @Translation("Test B"), * description = @Translation("Test B webform submission handler."), * cardinality = DrupalwebformPluginWebformHandlerInterface::CARDINALITY_UNLIMITED, * results = DrupalwebformPluginWebformHandlerInterface::RESULTS_PROCESSED, * submission = DrupalwebformPluginWebformHandlerInterface::SUBMISSION_OPTIONAL, * ) */ class TestBWebformHandler extends WebformHandlerBase { /** * {@inheritdoc} */ public function preSave(WebformSubmissionInterface $webform_submission) { Drupal::messenger()->addMessage(t('xyz')); } }
On navigating to my Webform settings, I see:
but when I click Add handler for Test B it does not attach to my form handlers?