diff --git a/README.md b/README.md index 652db57..da98342 100644 --- a/README.md +++ b/README.md @@ -75,9 +75,11 @@ Override the default action name by adding an action option: 1. Add the Cloudflare Turnstile widget in the Smarty form template: ```html -{widget name='pixel_cloudflare_turnstile' action='custom-form'} +{widget name='pixel_cloudflare_turnstile' custom='1' action='custom-form'} ``` +**Note:** The action param is a free name that will appear in the Turnstile statistics + 2. In a module, add a new hook to call Turnstile validation on form post: ```php diff --git a/pixel_cloudflare_turnstile.php b/pixel_cloudflare_turnstile.php index 893646b..9347856 100644 --- a/pixel_cloudflare_turnstile.php +++ b/pixel_cloudflare_turnstile.php @@ -34,7 +34,7 @@ class Pixel_cloudflare_turnstile extends Module implements WidgetInterface public function __construct() { $this->name = 'pixel_cloudflare_turnstile'; - $this->version = '1.1.2'; + $this->version = '1.1.3'; $this->author = 'Pixel Open'; $this->tab = 'front_office_features'; $this->need_instance = 0; @@ -367,7 +367,8 @@ protected static function getErrorMessage(string $code): string public function renderWidget($hookName, array $configuration): string { $className = get_class($this->context->controller); - if (!$this->canProcess($className)) { + $isCustom = (int)($configuration['custom'] ?? 0) === 1; + if (!$isCustom && !$this->canProcess($className)) { return ''; } $keys = [$this->name, $className, $this->getFormName()];