You are here

function hook_webform_handler_invoke_alter in Webform 8.5

Same name and namespace in other branches
  1. 6.x webform.api.php \hook_webform_handler_invoke_alter()

Act on a webform handler when a method is invoked.

Allows module developers to implement custom logic that can executed before any webform handler method is invoked.

This hook can be used to…

  • Conditionally enable or disable a handler.
  • Alter a handler's configuration.
  • Preprocess submission data being passed to a webform handler.

Parameters

\Drupal\webform\Plugin\WebformHandlerInterface $handler: A webform handler attached to a webform.

string $method_name: The invoked method name converted to snake case.

array $args: Argument being passed to the handler's method.

See also

\Drupal\webform\Plugin\WebformHandlerInterface

1 function implements hook_webform_handler_invoke_alter()

Note: this list is generated by pattern matching, so it may include some functions that are not actually implementations of this hook.

webform_test_handler_invoke_alter_webform_handler_invoke_alter in tests/modules/webform_test_handler_invoke_alter/webform_test_handler_invoke_alter.module
Implements hook_webform_handler_invoke_alter().
1 invocation of hook_webform_handler_invoke_alter()
Webform::invokeHandlerAlter in src/Entity/Webform.php
Alter a webform handler when it is invoked.

File

./webform.api.php, line 441
Hooks related to Webform module.

Code

function hook_webform_handler_invoke_alter(\Drupal\webform\Plugin\WebformHandlerInterface $handler, $method_name, array &$args) {
  $webform = $handler
    ->getWebform();
  $webform_submission = $handler
    ->getWebformSubmission();
  $webform_id = $handler
    ->getWebform()
    ->id();
  $handler_id = $handler
    ->getHandlerId();
  $state = $webform_submission
    ->getState();
}