diff --git a/CHANGELOG.md b/CHANGELOG.md index 8d0ef92b8..2f4002e9d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,4 +2,5 @@ ## DEV + * Add a custom text field to the subscribe module (see contao/core-bundle#1512). * Use type="email" in the default template (see #20). diff --git a/src/Resources/contao/dca/tl_module.php b/src/Resources/contao/dca/tl_module.php index 4f69b07cd..c879579a7 100644 --- a/src/Resources/contao/dca/tl_module.php +++ b/src/Resources/contao/dca/tl_module.php @@ -10,7 +10,7 @@ // Add palettes to tl_module $GLOBALS['TL_DCA']['tl_module']['palettes']['personalData'] = str_replace(',editable', ',editable,newsletters', $GLOBALS['TL_DCA']['tl_module']['palettes']['personalData']); -$GLOBALS['TL_DCA']['tl_module']['palettes']['subscribe'] = '{title_legend},name,headline,type;{config_legend},nl_channels,nl_hideChannels,disableCaptcha;{redirect_legend},jumpTo;{email_legend:hide},nl_subscribe;{template_legend:hide},nl_template;{protected_legend:hide},protected;{expert_legend:hide},guests,cssID'; +$GLOBALS['TL_DCA']['tl_module']['palettes']['subscribe'] = '{title_legend},name,headline,type;{config_legend},nl_channels,nl_hideChannels,disableCaptcha;{text_legend},nl_text;{redirect_legend},jumpTo;{email_legend:hide},nl_subscribe;{template_legend:hide},nl_template;{protected_legend:hide},protected;{expert_legend:hide},guests,cssID'; $GLOBALS['TL_DCA']['tl_module']['palettes']['unsubscribe'] = '{title_legend},name,headline,type;{config_legend},nl_channels,nl_hideChannels,disableCaptcha;{redirect_legend},jumpTo;{email_legend:hide},nl_unsubscribe;{template_legend:hide},nl_template;{protected_legend:hide},protected;{expert_legend:hide},guests,cssID'; $GLOBALS['TL_DCA']['tl_module']['palettes']['newsletterlist'] = '{title_legend},name,headline,type;{config_legend},nl_channels;{template_legend:hide},customTpl;{protected_legend:hide},protected;{expert_legend:hide},guests,cssID'; $GLOBALS['TL_DCA']['tl_module']['palettes']['newsletterreader'] = '{title_legend},name,headline,type;{config_legend},nl_channels;{template_legend:hide},customTpl;{protected_legend:hide},protected;{expert_legend:hide},guests,cssID'; @@ -36,6 +36,16 @@ 'sql' => "blob NULL" ); +$GLOBALS['TL_DCA']['tl_module']['fields']['nl_text'] = array +( + 'label' => &$GLOBALS['TL_LANG']['tl_module']['nl_text'], + 'exclude' => true, + 'inputType' => 'textarea', + 'eval' => array('rte'=>'tinyMCE', 'helpwizard'=>true), + 'explanation' => 'insertTags', + 'sql' => "text NULL" +); + $GLOBALS['TL_DCA']['tl_module']['fields']['nl_hideChannels'] = array ( 'label' => &$GLOBALS['TL_LANG']['tl_module']['nl_hideChannels'], diff --git a/src/Resources/contao/languages/en/tl_module.xlf b/src/Resources/contao/languages/en/tl_module.xlf index e8c328446..b2447d049 100644 --- a/src/Resources/contao/languages/en/tl_module.xlf +++ b/src/Resources/contao/languages/en/tl_module.xlf @@ -14,6 +14,12 @@ Please select one or more channels. + + Custom text + + + Here you can e.g. enter a privacy note to make the newsletter subscription GDPR compliant. + Hide channel menu @@ -38,6 +44,9 @@ Here you can select the newsletter template. + + Custom text + Your subscription on %s @@ -46,7 +55,9 @@ ##channels## -Please click ##link## to activate your subscription. If you did not subscribe yourself, please ignore this e-mail. +Please click ##link## to activate your subscription. + +You can unsubscribe from our newsletter at any time. If you did not subscribe yourself, please ignore this e-mail. diff --git a/src/Resources/contao/modules/ModuleSubscribe.php b/src/Resources/contao/modules/ModuleSubscribe.php index cf60beabe..7c83c3535 100644 --- a/src/Resources/contao/modules/ModuleSubscribe.php +++ b/src/Resources/contao/modules/ModuleSubscribe.php @@ -18,6 +18,7 @@ * @property string $nl_subscribe * @property array $nl_channels * @property string $nl_template + * @property string $nl_text * @property bool $nl_hideChannels * * @author Leo Feyer @@ -158,6 +159,7 @@ protected function compile() $this->Template->action = \Environment::get('indexFreeRequest'); $this->Template->formId = $strFormId; $this->Template->id = $this->id; + $this->Template->text = $this->nl_text; } /** diff --git a/src/Resources/contao/templates/newsletter/nl_default.html5 b/src/Resources/contao/templates/newsletter/nl_default.html5 index d6fa25e98..814a05375 100644 --- a/src/Resources/contao/templates/newsletter/nl_default.html5 +++ b/src/Resources/contao/templates/newsletter/nl_default.html5 @@ -35,6 +35,12 @@ captcha ?> + text): ?> +
+ text ?> +
+ +