Skip to content

Commit

Permalink
Merge branch 'lonnieezell:develop' into add-2FA-shield-action
Browse files Browse the repository at this point in the history
  • Loading branch information
kgrruz authored Feb 17, 2024
2 parents a86a261 + c985f8a commit e2cc9f9
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 3 deletions.
10 changes: 10 additions & 0 deletions src/Consent/Config/Consent.php
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,16 @@ class Consent extends BaseConfig
*/
public string $policyUrl = 'privacy';

/**
* --------------------------------------------------------------------------
* Cookie Policy Document Title
* --------------------------------------------------------------------------
*
* A title of the document that contains the cookie policy.
* For example, 'Privacy Policy' or 'Cookie Policy'.
*/
public string $policyTitle = 'Cookie Policy';

/**
* --------------------------------------------------------------------------
* Cookie Message
Expand Down
2 changes: 2 additions & 0 deletions src/Consent/Controllers/ConsentSettingsController.php
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ public function save()
'requireConsent' => 'permit_empty',
'consentLength' => 'required_with[requireConsent]|string',
'policyUrl' => 'required_with[requireConsent]|string',
'policyTitle' => 'required_with[requireConsent]|string',
'consentMessage' => 'required_with[requireConsent]|string',
'consents.*.name' => 'required_with[requireConsent]|string',
'consents.*.desc' => 'required_with[requireConsent]|string',
Expand All @@ -58,6 +59,7 @@ public function save()
setting('Consent.requireConsent', $this->request->getPost('requireConsent') ? true : false);
setting('Consent.consentLength', $this->request->getPost('consentLength'));
setting('Consent.policyUrl', $this->request->getPost('policyUrl'));
setting('Consent.policyTitle', $this->request->getPost('policyTitle'));
setting('Consent.consentMessage', $this->request->getPost('consentMessage'));
setting('Consent.consents', $this->request->getPost('consents'));

Expand Down
3 changes: 2 additions & 1 deletion src/Consent/Filters/ConsentFilter.php
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,8 @@ public function after(RequestInterface $request, ResponseInterface $response, $a
$link = strpos('http', (string) $link) === 0
? $link
: site_url($link);
$html = str_ireplace('{policy_url}', "<a href='{$link}' target='_blank'>Cookie policy</a>", $html);
$policyTitle = setting('Consent.policyTitle');
$html = str_ireplace('{policy_url}', "<a href='{$link}' target='_blank'>{$policyTitle}</a>", $html);

$cssFile = setting('Consent.consentFormStyles');
$jsFile = setting('Consent.consentFormScripts');
Expand Down
16 changes: 14 additions & 2 deletions src/Consent/Views/settings.php
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,19 @@
<p class="text-muted small pt-5">May be either a full or relative URL</p>
</div>
</div>

<!-- Cookie Policy Document Title-->
<div class="row mb-3">
<div class="col-12 col-sm-6">
<label class="form-label" for="policyTitle">Title of Cookie Policy document</label>
<input type="text" class="form-control" name="policyTitle" value="<?= old('policyTitle', setting('Consent.policyTitle')) ?>">
<?php if (has_error('policyTitle')) : ?>
<p class="text-danger"><?= error('policyTitle') ?></p>
<?php endif ?>
</div>
<div class="col">
<p class="text-muted small pt-5">Will be shown in the Cookies Consent dialog instead of {policy_url}</p>
</div>
</div>
<!-- Consent Message -->
<div class="row mb-3">
<div class="col-12 col-sm-6">
Expand All @@ -65,7 +77,7 @@
<?php endif ?>
</div>
<div class="col">
<p class="text-muted small pt-5">May be either a full or relative URL. Will replace {policy_url} with the correct URL.</p>
<p class="text-muted small pt-5">May be either a full or relative URL. Will replace {policy_url} with the correct URL and Cookie Policy document title</p>
</div>
</div>
</fieldset>
Expand Down

0 comments on commit e2cc9f9

Please sign in to comment.