1

I have a custom module that implements a webform handler. I'm seeing this error in my Watchdog log when I navigate to admin/structure/webform/manage/myform/handlers:

Theme hook webform_handler_myform_form_handler_summary not found.

I must have missed something when creating my module, but what? What needs to be added? Searches for "webform handler theme hook" haven't been fruitful.

0

1 Answer 1

1

As seen in webform_example_handler

You need to add:

mymodule/mymodule.module

<?php

/**
 * @file
 * Provides a custom webform handler.
 */

/**
 * Implements hook_theme().
 */
function mymodule_theme() {
  return [
    'webform_handler_myform_form_handler_summary' => [
      'variables' => ['settings' => NULL, 'handler' => []],
    ],
  ];
}

mymodule/templates/webform-handler-myform-form-handler-summary.html.twig

{#
/**
 * @file
 * Default theme implementation for a summary of an example webform handler.
 *
 * Available variables:
 * - settings: The current configuration for this email handler:
 *   - message: The message.
 *   - debug: Debugging flag.
 * - handler: The handler information, including:
 *   - id: The handler plugin id.
 *   - handler_id: The handler id.
 *   - label: The handler label.
 *   - description: The handler description.
 *
 * @ingroup themeable
 */
#}
{% if settings.debug %}<b class="color-error">{{ 'Debugging is enabled'|t }}</b><br />{% endif %}
<b>Message:</b> {{ settings.message }}

Clear/flush the cache so your new hook & template file gets picked up.

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.