From 24dce862d6a9f0a37c51ac399182865c4f052e5e Mon Sep 17 00:00:00 2001 From: Seersco Date: Tue, 19 Apr 2022 12:02:22 +0500 Subject: [PATCH] =?UTF-8?q?=C3=8Fnitial=20Commit=20module=20v1.0.2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- composer.json | 13 +++ ...nsent_privacy_policy.seercookieconsent.yml | 1 + css/cookie-style.css | 7 ++ seers_cookie_consent_privacy_policy.info.yml | 6 ++ ...ookie_consent_privacy_policy.libraries.yml | 5 ++ ...okie_consent_privacy_policy.links.menu.yml | 6 ++ seers_cookie_consent_privacy_policy.module | 81 +++++++++++++++++++ ..._cookie_consent_privacy_policy.routing.yml | 9 +++ ...cookie_consent_privacy_policy.services.yml | 3 + src/Form/SeerCookieConsentForm.php | 60 ++++++++++++++ src/Service/CustomFunctions.php | 60 ++++++++++++++ ...rs-cookie-consent-privacy-policy.html.twig | 1 + tests/src/Functional/LoadTest.php | 46 +++++++++++ 13 files changed, 298 insertions(+) create mode 100644 composer.json create mode 100644 config/install/seers_cookie_consent_privacy_policy.seercookieconsent.yml create mode 100644 css/cookie-style.css create mode 100644 seers_cookie_consent_privacy_policy.info.yml create mode 100644 seers_cookie_consent_privacy_policy.libraries.yml create mode 100644 seers_cookie_consent_privacy_policy.links.menu.yml create mode 100644 seers_cookie_consent_privacy_policy.module create mode 100644 seers_cookie_consent_privacy_policy.routing.yml create mode 100644 seers_cookie_consent_privacy_policy.services.yml create mode 100644 src/Form/SeerCookieConsentForm.php create mode 100644 src/Service/CustomFunctions.php create mode 100644 templates/seers-cookie-consent-privacy-policy.html.twig create mode 100644 tests/src/Functional/LoadTest.php diff --git a/composer.json b/composer.json new file mode 100644 index 0000000..b6349d9 --- /dev/null +++ b/composer.json @@ -0,0 +1,13 @@ +{ + "name": "seers_cookie_consent_privacy_policy", + "type": "drupal-module", + "description": "Seers cookie consent fulfils the requirements of transparency, consent and documentation under ePrivacy Directive and GDPR.", + "keywords": [ + ], + "homepage": "https://www.drupal.org/project/seers_cookie_consent_privacy_policy", + "minimum-stability": "dev", + "support": { + "issues": "https://www.drupal.org/project/issues/seers_cookie_consent_privacy_policy", + "source": "http://cgit.drupalcode.org/seers_cookie_consent_privacy_policy" + } +} diff --git a/config/install/seers_cookie_consent_privacy_policy.seercookieconsent.yml b/config/install/seers_cookie_consent_privacy_policy.seercookieconsent.yml new file mode 100644 index 0000000..6d7f9d0 --- /dev/null +++ b/config/install/seers_cookie_consent_privacy_policy.seercookieconsent.yml @@ -0,0 +1 @@ +seers_cookie_consent_privacy_policy: diff --git a/css/cookie-style.css b/css/cookie-style.css new file mode 100644 index 0000000..67f9a05 --- /dev/null +++ b/css/cookie-style.css @@ -0,0 +1,7 @@ + +/* +* For Cookie Policy & Cookie Declarations +*/ +.cx-policy-container, .cx-table-container { + width: 100% !important; +} diff --git a/seers_cookie_consent_privacy_policy.info.yml b/seers_cookie_consent_privacy_policy.info.yml new file mode 100644 index 0000000..5b0c077 --- /dev/null +++ b/seers_cookie_consent_privacy_policy.info.yml @@ -0,0 +1,6 @@ +name: 'Seers Cookie Consent Banner Privacy Policy' +type: module +description: 'Seers cookie consent fulfils the requirements of transparency, consent and documentation under ePrivacy Directive and GDPR.' +core: 8.x +core_version_requirement: ^7 || ^8 || ^9 +package: 'Custom' diff --git a/seers_cookie_consent_privacy_policy.libraries.yml b/seers_cookie_consent_privacy_policy.libraries.yml new file mode 100644 index 0000000..ef7931d --- /dev/null +++ b/seers_cookie_consent_privacy_policy.libraries.yml @@ -0,0 +1,5 @@ +global: + version: VERSION + css: + theme: + css/cookie-style.css: {} diff --git a/seers_cookie_consent_privacy_policy.links.menu.yml b/seers_cookie_consent_privacy_policy.links.menu.yml new file mode 100644 index 0000000..12c551f --- /dev/null +++ b/seers_cookie_consent_privacy_policy.links.menu.yml @@ -0,0 +1,6 @@ +seers_cookie_consent_privacy_policy.seer_cookie_consent_form: + title: 'SeerCookieConsentForm' + route_name: seers_cookie_consent_privacy_policy.seer_cookie_consent_form + description: 'Enter your cookie id' + parent: system.admin_config_system + weight: 99 diff --git a/seers_cookie_consent_privacy_policy.module b/seers_cookie_consent_privacy_policy.module new file mode 100644 index 0000000..6c48565 --- /dev/null +++ b/seers_cookie_consent_privacy_policy.module @@ -0,0 +1,81 @@ +doActiveInactive(1, $modulename); + +} + + +/** + * Implements hook_preprocess(). + */ +function seers_cookie_consent_privacy_policy_preprocess_page(&$variables, $hook) +{ + + $variables['#attached']['library'][] = 'seers_cookie_consent_privacy_policy/global'; + +} + +/** + * Implements hook_page_attachments(). + */ +function seers_cookie_consent_privacy_policy_page_attachments(&$page) +{ + $config = \Drupal::config('seers_cookie_consent_privacy_policy.seercookieconsent')->getRawData(); + /** + * Initial JS. + */ + if (!empty($config["cookie_id"])) { + $page['#attached']['html_head'][] = [ + [ + // Add a