Skip to content
Snippets Groups Projects
Commit 9524b063 authored by Roberto Peruzzo's avatar Roberto Peruzzo
Browse files

Resolve #3314506 "Allow custom input"

parent 406e127e
No related branches found
No related tags found
1 merge request!35Resolve #3314506 "Allow custom input"
......@@ -18,47 +18,19 @@ Iubenda Integration also provides a new block "Iubenda Integration:
Privacy policy", allowing you to say "Why another block?!"... eheh bad stories,
but sometimes could be useful :)
Features:
* The module automatically inserts the Iubenda code in the head of every
website pages.
## Features:
* The module automatically inserts the Iubenda code in the head of every website pages.
* It handles the display of privacy policy.
### Iubenda Integration 3.x
To be completed...
### Iubenda Integration 8.x-2.x
This version is an All-in-One approach which helps you to integrate into your
Drupal website the privacy policy text, the cookie banner and the blocking
management of cookies.
Find a comprehensive guide and demo to the cookie law solution on our help blog
https://www.iubenda.com/en/help/posts/1177
This plugin works with the Iubenda Cookie Law Solution and allows to block the
most common widgets and third party cookies to comply with Cookie Laws,
particularly with the Italian cookie law implementation in mind.
Features:
* It handles the display of cookie banners and cookie policy, saving user
preferences about the use of cookies.
* It displays a clean page (without banner) to users who have already provided
their consent.
* It handles the display of cookie banners and cookie policy, saving user preferences about the use of cookies.
* It displays a clean page (without banner) to users who have already provided their consent.
* It detects bots/spiders and serves them a clean page.
The plugin is currently capable of automatically detecting and blocking the
following scripts:
* Facebook widgets
* Twitter widgets
* Google+ widgets
* Google AdSense
* YouTube widgets
* AddThis widgets
* ShareThis widgets
* Google Maps widgets
## Status:
* 4.x - Actively supported.
* 3.x - Actively supported.
* 8.x-2.x - No more supported!
* 7.x-2.x - Bug fixing only.
* 7.x-1.x - No more supported!
## REQUIREMENTS
Iubenda Integration 8.x-2.x work with:
......@@ -67,25 +39,37 @@ Iubenda Integration 8.x-2.x work with:
## INSTALLATION
* Install as you would normally install a contributed Drupal module. See:
https://drupal.org/documentation/install/modules-themes/modules-7
for further information.
* Download Iubenda PHP class http://simon.s3.iubenda.com/iubenda-cookie-class.
Unpack and rename the class directory to "iubenda_integration", afterward
place it inside the "sites/all/libraries" directory on your server. Make sure
the path to the class file becomes:
"<drupal_root>/libraries/iubenda_intragration/iubenda.class.php"
### Drupal 9/10
Install using composer. Run this command in your project root folder:
composer require drupal/iubenda_integration
Iubenda PHP class iubenda/iubenda-cookie-class will be automatically included.
### Drupal 7
Install as you would normally install a contributed Drupal module. See: https://drupal.org/documentation/install/modules-themes/modules-7 for further information.
Download and install the Libraries API 2 module and the Iubenda Integration module as normal. Then download the Iubenda PHP class for cookies which allows blocking prior to consent.
Download Iubenda PHP class: https://github.com/iubenda/iubenda-cookie-class/releases
Unpack and rename the class directory to "iubenda-cookie-class", afterward place it inside the "sites/all/libraries" directory on your server.
Make sure the path to the class file becomes: "sites/all/libraries/iubenda-cookie-class-4.1.8/iubenda.class.php"
Install with Drush
The easiest way to download and install the module and the PHP class is via the built in Drush commands
drush dl iubenda_integration (download the module)
drush en iubenda_integration (enable the module, download and install the
Iubenda PHP class)
drush iubenda-php-class (download and install the Iubenda PHP class)
If you use a drush make workflow, Drush automatically download the library using the iubenda_integration.make file.
## CONFIGURATION
Go to "Configuration" -> "Web Services" -> "Iubenda integration" to find
all the configuration options (admin/config/services/iubenda-integration).
* Enable Iubenda Integration module and configure it from "admin/config/system/iubenda-integration"
* Do you really need a privacy policy block?! Wow, you can configure it tough ;)
* Enjoy it!
## MAINTAINERS
Current maintainers:
* Daniele Piaggesi (g0blin79) - https://www.drupal.org/u/g0blin79
* Roberto Peruzzo (robertoperuzzo) - https://www.drupal.org/u/robertoperuzzo
* Nikolas Costa (nikolas.costa) - https://www.drupal.org/u/nikolascosta
Module development and maintenance by:
* BMEME
......
......@@ -15,18 +15,22 @@ iubenda_integration.settings:
type: string
iubenda_integration_forms:
type: string
iubenda_integration_form_element_label:
type: label
label: 'Label text'
weight: 1
iubenda_integration_pretext:
type: text
label: 'Link prefix'
weight: 1
weight: 2
iubenda_integration_text:
type: label
label: 'Link text'
weight: 2
weight: 3
iubenda_integration_posttext:
type: text
label: 'Link suffix'
weight: 3
weight: 4
iubenda_integration_cookie_policy_enabled:
type: boolean
localConsentPath:
......
......@@ -5,6 +5,7 @@
* Install, update and uninstall functions for the Iubenda Integration module.
*/
use Composer\InstalledVersions;
use Drupal\Core\Url;
use Drupal\Core\Link;
......@@ -34,4 +35,15 @@ function iubenda_integration_requirements($phase) {
'severity' => $library_exists ? REQUIREMENT_OK : REQUIREMENT_ERROR,
],
];
if (!class_exists('iubendaParser')) {
$requirements['iubenda-cookie-class']['value'] = t('@e: At least @a', [
'@e' => 'Iubenda cookie class not installed.',
'@a' => $version,
]);
$requirements['iubenda-cookie-class']['severity'] = REQUIREMENT_ERROR;
$requirements['iubenda-cookie-class']['description'] = t('You need to install this module with Composer. Alternatively, you can use <a href="https://www.drupal.org/project/ludwig" target="_blank">Ludwig</a> to manage this library dependancy.');
}
return $requirements;
}
......@@ -15,13 +15,7 @@ if (\Drupal::hasService('ludwig.require_once')) {
* Defining Iubenda privacy policy URL.
*/
define('IUBENDA_INTEGRATION_PRIVACY_POLICY_URL', '//www.iubenda.com/privacy-policy/');
/**
* The minimum required version of the Iubenda PHP class plugin.
*/
define('IUBENDA_INTEGRATION_CLASS_MIN_VER', '4.1.8');
define('IUBENDA_INTEGRATION_CLASS_LIB_NAME', 'iubenda-cookie-class');
define('IUBENDA_INTEGRATION_MODULE_NAME', basename(__FILE__, '.module'));
define('IUBENDA_INTEGRATION_TOKEN_NAME', basename(__FILE__, '.module'));
use Drupal\Core\Link;
use Drupal\Core\Url;
......@@ -62,7 +56,7 @@ function iubenda_integration_form_alter(&$form, FormStateInterface &$form_state,
$form['iubenda_integration_privacy_policy'] = [
'#type' => \Drupal::config('iubenda_integration.settings')->get('iubenda_integration_form_element_type'),
'#title' => t('Yes'),
'#title' => \Drupal::config('iubenda_integration.settings')->get('iubenda_integration_form_element_label') ?: t('Yes'),
'#description' => iubenda_integration_build_string(),
'#required' => TRUE,
'#weight' => $weight,
......@@ -146,7 +140,7 @@ function iubenda_integration_build_link() {
* Implements hook_token_info_alter().
*/
function iubenda_integration_token_info() {
$info['tokens']['site'][IUBENDA_INTEGRATION_MODULE_NAME] = [
$info['tokens']['site'][IUBENDA_INTEGRATION_TOKEN_NAME] = [
'name' => t('Iubenda'),
'description' => t('The Iubenda privacy policy link'),
];
......@@ -162,7 +156,7 @@ function iubenda_integration_tokens($type, $tokens, array $data = [], array $opt
if ($type == 'site') {
foreach ($tokens as $name => $original) {
if ($name == IUBENDA_INTEGRATION_MODULE_NAME) {
if ($name == IUBENDA_INTEGRATION_TOKEN_NAME) {
$replacements[$original] = iubenda_integration_build_link();
}
}
......
......@@ -94,6 +94,13 @@ class IubendaSettingsForm extends ConfigFormBase {
'#default_value' => $iubenda_config
->get('iubenda_integration_form_element_type'),
];
$form['form']['iubenda_integration_form_element_label'] = [
'#title' => $this->t('Form element label'),
'#description' => $this->t('This text will be displayed as label of the input form element to accept the privacy policy. "Yes" is the default label.'),
'#type' => 'textfield',
'#default_value' => $iubenda_config->get('iubenda_integration_form_element_label') ?? 'Yes',
'#required' => TRUE,
];
$form['form']['iubenda_integration_forms'] = [
'#title' => $this->t('Privacy Policy Forms'),
'#description' => $this->t('Insert here the form ids list (one per line)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment