Skip to content

Commit

Permalink
Merge pull request #8 from pixelant/feature/hide_recapcha
Browse files Browse the repository at this point in the history
Feature/hide recapcha
  • Loading branch information
MattiasNilsson authored Aug 17, 2017
2 parents 4db95ee + 4a2a010 commit 95076e2
Show file tree
Hide file tree
Showing 7 changed files with 164 additions and 10 deletions.
20 changes: 13 additions & 7 deletions Configuration/TypoScript/constants.txt
Original file line number Diff line number Diff line change
@@ -1,11 +1,17 @@
# Settings for recaptcha
plugin.tx_pxaformenhancement {
# customsubcategory=recaptcha=Recaptcha configuration
settings {
# cat=plugin.tx_pxaformenhancement/recaptcha/015; type=string; label=Site key
siteKey =
# customsubcategory=recaptcha=Recaptcha configuration
settings {
# cat=plugin.tx_pxaformenhancement/recaptcha/015; type=string; label=Site key
siteKey =

# cat=plugin.tx_pxaformenhancement/recaptcha/020; type=string; label=Site secret
siteSecret =
}
# cat=plugin.tx_pxaformenhancement/recaptcha/020; type=string; label=Site secret
siteSecret =
}

# customsubcategory=general_settings=Settings
settings {
# cat=plugin.tx_pxaformenhancement/general_settings/010; type=options[Yes=1,No=0]; label=Hide reCaptcha on summary page and in email
hideRecaptchaOnSummaryPage = 0
}
}
17 changes: 14 additions & 3 deletions Configuration/TypoScript/setup.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
plugin.tx_pxaformenhancement{
plugin.tx_pxaformenhancement {
settings {
siteSecret = {$plugin.tx_pxaformenhancement.settings.siteSecret}
siteKey = {$plugin.tx_pxaformenhancement.settings.siteKey}
Expand All @@ -7,7 +7,7 @@ plugin.tx_pxaformenhancement{

plugin.tx_form {
view {
partialRootPaths.510 = EXT:pxa_form_enhancement/Resources/Private/Frontend/Partials/
partialRootPaths.510 = EXT:pxa_form_enhancement/Resources/Private/Frontend/Partials/
}

settings {
Expand All @@ -16,4 +16,15 @@ plugin.tx_form {
520 = EXT:pxa_form_enhancement/Configuration/Yaml/PxaFormEngine.yaml
}
}
}
}

# if we need to replace summary page template
[globalVar = LIT:1 = {$plugin.tx_pxaformenhancement.settings.hideRecaptchaOnSummaryPage}]
plugin.tx_form {
settings {
yamlConfigurations {
530 = EXT:pxa_form_enhancement/Configuration/Yaml/PxaFormAdditionalConfiguration.yaml
}
}
}
[end]
16 changes: 16 additions & 0 deletions Configuration/Yaml/PxaFormAdditionalConfiguration.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
TYPO3:
CMS:
Form:
prototypes:
standard:
formElementsDefinition:
Form:
renderingOptions:
partialRootPaths:
620: 'EXT:pxa_form_enhancement/Resources/Private/Frontend/PartialsAdditional/'
########### MIXINS ###########
mixins:
finishersEmailMixin:
options:
templateRootPaths:
610: 'EXT:pxa_form_enhancement/Resources/Private/Frontend/Templates/Finishers/Email/'
9 changes: 9 additions & 0 deletions README.MD
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,15 @@ Add reCAPTCHA site key and site secret constants. You can get these keys on [off
plugin.tx_pxaformenhancement.settings.siteKey = siteKeyHere
plugin.tx_pxaformenhancement.settings.siteSecret = siteSecret
```
### Hide reCAPTCHA on summary page and in email ###
ReCAPTCHA can be removed from summary page and emails using constants configuration. Set value of "hideRecaptchaOnSummaryPage"
constant to "1". Note that this option will change default path of summary and emails templates.

```
#!typoscript
plugin.tx_pxaformenhancement.settings.hideRecaptchaOnSummaryPage = 1
```

## Using reCAPTCHA ##

Expand Down
48 changes: 48 additions & 0 deletions Resources/Private/Frontend/PartialsAdditional/SummaryPage.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
<html xmlns:f="http://typo3.org/ns/TYPO3/CMS/Fluid/ViewHelpers" xmlns:formvh="http://typo3.org/ns/TYPO3/CMS/Form/ViewHelpers" data-namespace-typo3-fluid="true">
<formvh:renderRenderable renderable="{page}">
<fieldset class="form-group">
<f:if condition="{page.label}">
<legend>{formvh:translateElementProperty(element: page, property: 'label')}</legend>
</f:if>
<div class="table-responsive">
<table class="table">
<formvh:renderAllFormValues renderable="{page.rootForm}" as="formValue">
<f:if condition="{formValue.element.type} != 'Recaptcha'">
<tr>
<td class="summary-table-first-col">{formvh:translateElementProperty(element: formValue.element, property: 'label')}</td>
<td>
<f:if condition="{formValue.value}">
<f:then>
<f:if condition="{0: formValue.element.type} == {0: 'ImageUpload'}">
<f:then>
<f:image image="{formValue.value}" maxWidth="{formValue.element.properties.imageMaxWidth}" maxHeight="{formValue.element.properties.imageMaxHeight}" alt="{formvh:translateElementProperty(element: formValue.element, property: 'altText')}" />
</f:then>
<f:else>
<f:if condition="{formValue.isMultiValue}">
<f:then>
<ul>
<f:for each="{formValue.processedValue}" as="value">
<li>{value}</li>
</f:for>
</ul>
</f:then>
<f:else>
{formValue.processedValue}
</f:else>
</f:if>
</f:else>
</f:if>
</f:then>
<f:else>
-
</f:else>
</f:if>
</td>
</tr>
</f:if>
</formvh:renderAllFormValues>
</table>
</div>
</fieldset>
</formvh:renderRenderable>
</html>
47 changes: 47 additions & 0 deletions Resources/Private/Frontend/Templates/Finishers/Email/Html.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
{namespace formvh=TYPO3\CMS\Form\ViewHelpers}
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title></title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta name="format-detection" content="telephone=no">
</head>
<body>
<table width="600" cellpadding="0" cellspacing="0" border="0">
<formvh:renderAllFormValues renderable="{form.formDefinition}" as="formValue">
<f:if condition="{formValue.element.type} != 'Recaptcha'">
<tr>
<td width="600" valign="top" align="left">{formvh:translateElementProperty(element: formValue.element, property: 'label')}</td>
<td width="600" valign="top" align="left">
<f:if condition="{formValue.value}">
<f:then>
<f:if condition="{formValue.isMultiValue}">
<f:then>
<table cellspacing="0" border="0">
<f:for each="{formValue.processedValue}" as="value">
<tr>
<td>{value}</td>
</tr>
</f:for>
</table>
</f:then>
<f:else>
<table cellspacing="0" border="0">
<tr>
<td>{formValue.processedValue}</td>
</tr>
</table>
</f:else>
</f:if>
</f:then>
<f:else>
-
</f:else>
</f:if>
</td>
</tr>
</f:if>
</formvh:renderAllFormValues>
</table>
</body>
</html>
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<html xmlns:f="http://typo3.org/ns/TYPO3/CMS/Fluid/ViewHelpers" xmlns:formvh="http://typo3.org/ns/TYPO3/CMS/Form/ViewHelpers" data-namespace-typo3-fluid="true">
<formvh:renderAllFormValues renderable="{form.formDefinition}" as="formValue"><f:spaceless>
<f:if condition="{formValue.element.type} != 'Recaptcha'">
<f:if condition="{formValue.isMultiValue}">
<f:then>
<formvh:translateElementProperty element="{formValue.element}" property="label" />:
<f:for each="{formValue.processedValue}" as="singleValue">- {singleValue}
</f:for>
</f:then>
<f:else>
<formvh:translateElementProperty element="{formValue.element}" property="label" />: <f:if condition="{formValue.processedValue}"><f:then>{formValue.processedValue}</f:then><f:else>-</f:else></f:if>
</f:else>
</f:if>
</f:if>
</f:spaceless>
</formvh:renderAllFormValues>
</html>

0 comments on commit 95076e2

Please sign in to comment.