TemplateHandler: Text geaendert, Platzierung im input-group Newsletter-Feld korrigiert
This commit is contained in:
@@ -146,10 +146,7 @@ class TemplateHandler
|
|||||||
$labelPreparing = $isGerman ? 'Sicherheitsprüfung wird vorbereitet …' : 'Preparing security check …';
|
$labelPreparing = $isGerman ? 'Sicherheitsprüfung wird vorbereitet …' : 'Preparing security check …';
|
||||||
$labelPreparing = htmlspecialchars($labelPreparing, \ENT_QUOTES, 'UTF-8');
|
$labelPreparing = htmlspecialchars($labelPreparing, \ENT_QUOTES, 'UTF-8');
|
||||||
|
|
||||||
// Zweizeilig dargestellt (per <br>, gerendert ueber innerHTML in fp-altcha.js): das
|
$labelVerified = $isGerman ? 'Ja, ich bin ein Mensch' : 'Security check<br>passed';
|
||||||
// <br> wird hier als normaler Attributwert htmlspecialchars-kodiert und vom Browser
|
|
||||||
// beim Auslesen per getAttribute() wieder zu einem echten Zeilenumbruch dekodiert.
|
|
||||||
$labelVerified = $isGerman ? 'Sicherheitsprüfung<br>bestanden' : 'Security check<br>passed';
|
|
||||||
$labelVerified = htmlspecialchars($labelVerified, \ENT_QUOTES, 'UTF-8');
|
$labelVerified = htmlspecialchars($labelVerified, \ENT_QUOTES, 'UTF-8');
|
||||||
|
|
||||||
$labelFailed = $isGerman
|
$labelFailed = $isGerman
|
||||||
@@ -162,7 +159,7 @@ class TemplateHandler
|
|||||||
: 'Please wait a moment, the security check is still running.';
|
: 'Please wait a moment, the security check is still running.';
|
||||||
$labelWait = htmlspecialchars($labelWait, \ENT_QUOTES, 'UTF-8');
|
$labelWait = htmlspecialchars($labelWait, \ENT_QUOTES, 'UTF-8');
|
||||||
|
|
||||||
$html = '<div class="fp-altcha form-group" data-fp-altcha="' . $challengeJson . '"'
|
$html = '<div class="fp-altcha form-group mt-2" data-fp-altcha="' . $challengeJson . '"'
|
||||||
. ' data-label-verified="' . $labelVerified . '"'
|
. ' data-label-verified="' . $labelVerified . '"'
|
||||||
. ' data-label-failed="' . $labelFailed . '"'
|
. ' data-label-failed="' . $labelFailed . '"'
|
||||||
. ' data-label-wait="' . $labelWait . '">'
|
. ' data-label-wait="' . $labelWait . '">'
|
||||||
@@ -171,9 +168,24 @@ class TemplateHandler
|
|||||||
. '<input type="hidden" name="altcha" class="fp-altcha-input" value="">'
|
. '<input type="hidden" name="altcha" class="fp-altcha-input" value="">'
|
||||||
. '</div>';
|
. '</div>';
|
||||||
|
|
||||||
// Direkt vor dem Absende-Button einfügen.
|
|
||||||
$submitButton = $form->find('button[type="submit"], input[type="submit"]');
|
$submitButton = $form->find('button[type="submit"], input[type="submit"]');
|
||||||
|
|
||||||
|
// Bei schmalen Bootstrap-"input-group"-Formularen (z. B. das Newsletter-Feld im Footer:
|
||||||
|
// ein einzeiliges Eingabefeld mit direkt angehängtem Absende-Button) wuerde das Widget,
|
||||||
|
// direkt vor den Button gesetzt, mit in die schmale, einzeilige Button-Leiste gequetscht.
|
||||||
|
// In diesem Fall wird das Widget stattdessen als eigene Zeile UNTER der gesamten
|
||||||
|
// input-group platziert.
|
||||||
|
$inputGroup = null;
|
||||||
if (\count($submitButton) > 0) {
|
if (\count($submitButton) > 0) {
|
||||||
|
$candidateGroup = $submitButton->eq(0)->parents('.input-group')->eq(0);
|
||||||
|
if (\count($candidateGroup) > 0) {
|
||||||
|
$inputGroup = $candidateGroup;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($inputGroup !== null) {
|
||||||
|
$inputGroup->after($html);
|
||||||
|
} elseif (\count($submitButton) > 0) {
|
||||||
$submitButton->eq(0)->before($html);
|
$submitButton->eq(0)->before($html);
|
||||||
} else {
|
} else {
|
||||||
$form->append($html);
|
$form->append($html);
|
||||||
|
|||||||
Reference in New Issue
Block a user