diff options
author | Dirk Weise <wedi@users.noreply.github.com> | 2020-12-31 05:34:33 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-12-31 05:34:33 +0300 |
commit | 28085aa33ef19679b542636ecb59f4ceca4aa471 (patch) | |
tree | 7265363042a715759d5ea9a7e84e428ac0782d02 /plugins/PrivacyManager | |
parent | ed70bf6d937277b05ec1b11fdcd3fa9ea7c570a9 (diff) |
Add imprint URL to Template.pageFooter (#16966)
* Add imprint URL to Template.pageFooter
* Remove German translation
Co-authored-by: diosmosis <diosmosis@users.noreply.github.com>
Diffstat (limited to 'plugins/PrivacyManager')
-rw-r--r-- | plugins/PrivacyManager/PrivacyManager.php | 4 | ||||
-rw-r--r-- | plugins/PrivacyManager/SystemSettings.php | 14 | ||||
-rw-r--r-- | plugins/PrivacyManager/lang/en.json | 3 | ||||
-rw-r--r-- | plugins/PrivacyManager/templates/footerLinks.twig | 2 |
4 files changed, 22 insertions, 1 deletions
diff --git a/plugins/PrivacyManager/PrivacyManager.php b/plugins/PrivacyManager/PrivacyManager.php index 46bbc5d64d..f11ff26b43 100644 --- a/plugins/PrivacyManager/PrivacyManager.php +++ b/plugins/PrivacyManager/PrivacyManager.php @@ -716,14 +716,16 @@ class PrivacyManager extends Plugin return; } + $imprintUrl = $settings->imprintUrl->getValue(); $privacyPolicyUrl = $settings->privacyPolicyUrl->getValue(); $termsAndConditionUrl = $settings->termsAndConditionUrl->getValue(); - if (empty($privacyPolicyUrl) && empty($termsAndConditionUrl)) { + if (empty($imprintUrl) && empty($privacyPolicyUrl) && empty($termsAndConditionUrl)) { return; } $view = new View('@PrivacyManager/footerLinks.twig'); + $view->imprintUrl = $imprintUrl; $view->privacyPolicyUrl = $privacyPolicyUrl; $view->termsAndCondition = $termsAndConditionUrl; $out .= $view->render(); diff --git a/plugins/PrivacyManager/SystemSettings.php b/plugins/PrivacyManager/SystemSettings.php index d64a116d3a..611a3d2786 100644 --- a/plugins/PrivacyManager/SystemSettings.php +++ b/plugins/PrivacyManager/SystemSettings.php @@ -21,6 +21,9 @@ use Piwik\Settings\FieldConfig; class SystemSettings extends \Piwik\Settings\Plugin\SystemSettings { /** @var SystemSetting */ + public $imprintUrl; + + /** @var SystemSetting */ public $privacyPolicyUrl; /** @var SystemSetting */ @@ -31,11 +34,22 @@ class SystemSettings extends \Piwik\Settings\Plugin\SystemSettings protected function init() { + $this->imprintUrl = $this->createImprintUrlSetting(); $this->privacyPolicyUrl = $this->createPrivacyPolicyUrlSetting(); $this->termsAndConditionUrl = $this->createTermsAndConditionUrlSetting(); $this->showInEmbeddedWidgets = $this->createShowInEmbeddedWidgetsSetting(); } + private function createImprintUrlSetting(): SystemSetting + { + return $this->makeSetting('ImprintUrl', $default = '', FieldConfig::TYPE_STRING, function (FieldConfig $field) { + $field->title = Piwik::translate('PrivacyManager_ImprintUrl'); + $field->uiControl = FieldConfig::UI_CONTROL_TEXT; + $field->description = Piwik::translate('PrivacyManager_ImprintUrlDescription') . ' ' . + Piwik::translate('PrivacyManager_PrivacyPolicyUrlDescriptionSuffix', ['anonymous']); + }); + } + private function createPrivacyPolicyUrlSetting(): SystemSetting { return $this->makeSetting('privacyPolicyUrl', $default = '', FieldConfig::TYPE_STRING, function (FieldConfig $field) { diff --git a/plugins/PrivacyManager/lang/en.json b/plugins/PrivacyManager/lang/en.json index f54dea529b..751b44f3e0 100644 --- a/plugins/PrivacyManager/lang/en.json +++ b/plugins/PrivacyManager/lang/en.json @@ -173,6 +173,8 @@ "UseDeleteLog": "Regularly delete old raw data from the database", "UseDeleteReports": "Regularly delete old reports from the database", "UsersOptOut": "Users opt-out", + "ImprintUrl": "Imprint URL", + "ImprintUrlDescription": "A link to your Imprint page.", "PrivacyPolicyUrl": "Privacy Policy URL", "PrivacyPolicyUrlDescription": "A link to your Privacy Policy page.", "TermsAndConditionUrl": "Terms & Conditions URL", @@ -180,6 +182,7 @@ "PrivacyPolicyUrlDescriptionSuffix": "If you set this, it will be displayed at the bottom of the login page and on pages that the '%1$s' user can access.", "ShowInEmbeddedWidgets": "Show in embedded widgets", "ShowInEmbeddedWidgetsDescription": "If checked, a link to your Privacy Policy and your Terms & Conditions will be displayed at the bottom of embedded widgets.", + "Imprint": "Imprint", "PrivacyPolicy": "Privacy Policy", "TermsAndConditions": "Terms & Conditions" } diff --git a/plugins/PrivacyManager/templates/footerLinks.twig b/plugins/PrivacyManager/templates/footerLinks.twig index 61425ebdb0..5754e4f97f 100644 --- a/plugins/PrivacyManager/templates/footerLinks.twig +++ b/plugins/PrivacyManager/templates/footerLinks.twig @@ -1,4 +1,6 @@ <div id="footerLinks"> + {% if imprintUrl|default('') is not empty %}<a target="_blank" rel="noreferrer noopener" href="{{ imprintUrl|safelink|e('html_attr') }}">{{ 'PrivacyManager_Imprint'|translate }}</a>{% endif %} + {% if imprintUrl|default('') is not empty and (privacyPolicyUrl|default('') is not empty or termsAndCondition|default('') is not empty) %}|{% endif %} {% if privacyPolicyUrl|default('') is not empty %}<a target="_blank" rel="noreferrer noopener" href="{{ privacyPolicyUrl|safelink|e('html_attr') }}">{{ 'PrivacyManager_PrivacyPolicy'|translate }}</a>{% endif %} {% if privacyPolicyUrl|default('') is not empty and termsAndCondition|default('') is not empty %}|{% endif %} {% if termsAndCondition|default('') is not empty %}<a target="_blank" rel="noreferrer noopener" href="{{ termsAndCondition|safelink|e('html_attr') }}">{{ 'PrivacyManager_TermsAndConditions'|translate }}</a>{% endif %} |