-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Read captcha config from Backend Field config
- Loading branch information
Showing
2 changed files
with
46 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
<?php | ||
namespace Slub\SlubForms\ViewHelpers\Form; | ||
|
||
use TYPO3Fluid\Fluid\Core\ViewHelper\AbstractViewHelper; | ||
use TYPO3Fluid\Fluid\Core\Rendering\RenderingContextInterface; | ||
|
||
class ParseConfigurationViewHelper extends AbstractViewHelper { | ||
|
||
|
||
/** | ||
* Register arguments. | ||
* @return void | ||
*/ | ||
public function initializeArguments() | ||
{ | ||
parent::initializeArguments(); | ||
$this->registerArgument('configurationString', 'string', 'Config string', true); | ||
|
||
} | ||
|
||
/** | ||
* @return string | ||
*/ | ||
public static function renderStatic( | ||
array $arguments, | ||
\Closure $renderChildrenClosure, | ||
RenderingContextInterface $renderingContext | ||
) { | ||
|
||
$templateVariableContainer = $renderingContext->getVariableProvider(); | ||
|
||
if ($templateVariableContainer->exists('configuration')) { | ||
$templateVariableContainer->remove('configuration'); | ||
} | ||
$templateVariableContainer->add('configuration', \Slub\SlubForms\Helper\ArrayHelper::configToArray($arguments['configurationString'])); | ||
|
||
return $renderChildrenClosure(); | ||
|
||
} | ||
|
||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
{namespace sf=Slub\SlubForms\ViewHelpers} | ||
<script | ||
type="module" | ||
src="https://cdn.jsdelivr.net/npm/[email protected]/widget.module.min.js" | ||
|
@@ -9,7 +10,9 @@ | |
|
||
<div class="field_description"> | ||
<f:form.hidden name="field[{fieldset.uid}][{field.uid}]" class="{field.shortname}" /> | ||
<div class="frc-captcha" data-sitekey="FCMLJCSR6Q54F53S" data-lang="de" data-start="auto" data-solution-field-name="tx_slubforms_sf[field][{fieldset.uid}][{field.uid}]"></div> | ||
<f:format.raw><sf:form.parseConfiguration configurationString="{field.configuration}"> | ||
<div class="frc-captcha" data-sitekey="{configuration.sitekey}" data-lang="de" data-start="auto" data-solution-field-name="tx_slubforms_sf[field][{fieldset.uid}][{field.uid}]"></div> | ||
</sf:form.parseConfiguration></f:format.raw> | ||
|
||
<label class="error" for="tx_slubforms_sf[field][{fieldset.uid}][{field.uid}]"></label> | ||
</div> |