Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
bennyborn committed Feb 26, 2020
1 parent 6253da5 commit afc9821
Showing 1 changed file with 15 additions and 6 deletions.
21 changes: 15 additions & 6 deletions src/Resources/contao/dca/tl_form_field.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,20 @@
<?php

// alter palette for use with reCaptcha V3
$GLOBALS['TL_DCA']['tl_form_field']['config']['onload_callback'][] = function() {

if( \Config::get('recaptchaType') != 'recaptcha3' ) {
return;
}

dump($GLOBALS['TL_DCA']['tl_form_field']['palettes']['captcha']);

$GLOBALS['TL_DCA']['tl_form_field']['palettes']['captcha'] = str_replace('{fconfig_legend},', '{fconfig_legend},recaptcha3_threshold,recaptcha3_action,', $GLOBALS['TL_DCA']['tl_form_field']['palettes']['captcha']);
dump($GLOBALS['TL_DCA']['tl_form_field']['palettes']['captcha']);
};

$GLOBALS['TL_DCA']['tl_form_field']['fields'] += [
'recaptch3_threshold' => [
'recaptcha3_threshold' => [
'label' => &$GLOBALS['TL_LANG']['tl_form_field']['recaptcha3_threshold'],
'inputType' => 'text',
'sql' => "varchar(8) NOT NULL default ''",
Expand All @@ -13,8 +26,4 @@
'sql' => "varchar(120) NOT NULL default ''",
'eval' => ['tl_class' => 'w50', 'rgxp' => 'recaptcha']
],
];

if (Config::get('recaptchaType') != 'recaptcha3') return;

$GLOBALS['TL_DCA']['tl_form_field']['palettes']['captcha'] = str_replace(',type,label', ',type,label,recaptcha3_threshold,recaptcha3_action', $GLOBALS['TL_DCA']['tl_form_field']['palettes']['captcha']);
];

0 comments on commit afc9821

Please sign in to comment.