From 09ac3579c6a98e03272fbfebc4ffc1563fc5e77c Mon Sep 17 00:00:00 2001 From: Vincent Gao Date: Thu, 12 Sep 2024 10:14:44 +1000 Subject: [PATCH] update --- tide_webform.module | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/tide_webform.module b/tide_webform.module index 80f05ee..61e3da8 100644 --- a/tide_webform.module +++ b/tide_webform.module @@ -572,6 +572,7 @@ function _tide_webform_captcha_form_validate(&$form, FormStateInterface $form_st $settings['captcha_details'] = [ 'site_key' => $term->get('field_site_key')->value, 'term_id' => (int)$term_id, + 'captcha_id' => _tide_webform_get_captcha_id($term), ]; } else { $settings['captcha_details'] = null; @@ -611,3 +612,11 @@ function _tide_webform_threshold_validate($element, FormStateInterface $form_sta $form_state->setError($element, t('Enter a value between 0.0 and 1.0. Use only one decimal place (e.g., 0.0, 0.5, 1.0).')); } } + +/** + * Gets captcha id. + */ +function _tide_webform_get_captcha_id(Term $term) { + $uri = $term->toLink()->getUrl()->toString(); + return pathinfo(rtrim($uri, '/'), PATHINFO_BASENAME); +}