Commit 20c6dadd authored by John Brandenburg's avatar John Brandenburg Committed by webpurify
Browse files

Issue #3274107: Fix WebformHandler id and settings.

parent 0ba3665e
Loading
Loading
Loading
Loading
+4 −26
Original line number Diff line number Diff line
@@ -15,7 +15,7 @@ use Symfony\Component\DependencyInjection\ContainerInterface;
 * Webform example handler.
 *
 * @WebformHandler(
 *   id = "example",
 *   id = "webpurify",
 *   label = @Translation("Webpurify"),
 *   category = @Translation("Webpurify"),
 *   description = @Translation("Webform handler to utilize the Webpurify API."),
@@ -143,9 +143,11 @@ class WebpurifyWebformHandler extends WebformHandlerBase {
    parent::submitConfigurationForm($form, $form_state);
    $this->configuration['method'] = $form_state->getValue('method');
    $this->configuration['message'] = $form_state->getValue('message');
    $this->configuration['mode'] = $form_state->getValue('mode');
    $this->configuration['types'] = $form_state->getValue('types');
    $this->configuration['elements'] = $form_state->getValue('elements');
  }


  /**
   * {@inheritdoc}
   */
@@ -178,7 +180,6 @@ class WebpurifyWebformHandler extends WebformHandlerBase {
    $settings = $config['settings'];
    $webPurify = \Drupal::service('webpurify.api');
    // Only apply filter to selected elements.
    // TODO: Should these be configurable?
    $values = $webformSubmission->getData();
    foreach ($values as $key => $value) {
      if ($this->appliesToElement($key)) {
@@ -226,27 +227,4 @@ class WebpurifyWebformHandler extends WebformHandlerBase {
    }
    return FALSE;
  }



  /**
   * Display the invoked plugin method to end user.
   *
   * @param string $method_name
   *   The invoked method name.
   * @param string $context1
   *   Additional parameter passed to the invoked method name.
   */
  protected function debug($method_name, $context1 = NULL) {
    if (!empty($this->configuration['debug'])) {
      $t_args = [
        '@id' => $this->getHandlerId(),
        '@class_name' => get_class($this),
        '@method_name' => $method_name,
        '@context1' => $context1,
      ];
      $this->messenger()->addWarning($this->t('Invoked @id: @class_name:@method_name @context1', $t_args), TRUE);
    }
  }

}