Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
}
],
"require": {
"drupal/checklistapi": "^1.0"
"drupal/checklistapi": "^1.0",
"drupal/entity_reference_revisions": "^1.4"
}
}
1 change: 1 addition & 0 deletions gdpr.info.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,4 @@ package: General Data Protection Regulation

dependencies:
- drupal:checklistapi
- drupal:message
53 changes: 53 additions & 0 deletions gdpr.module
Original file line number Diff line number Diff line change
Expand Up @@ -469,3 +469,56 @@ function _get_modules() {
return $modules_list;
}
}

/**
* Implements hook_toolbar().
*/
function gdpr_toolbar() {
$user = \Drupal::currentUser();

$items = [];

$items['gdpr'] = [
'#cache' => [
'contexts' => [
'user',
],
],
];

// Just add the root menu item.
// GDPR Tasks and GDPR Consent modules
// will modify this in hook_toolbar_alter.
if ($user->hasPermission('view gdpr tasks') || $user->hasPermission('manage gdpr agreements')) {
$items['gdpr'] += [
'#type' => 'toolbar_item',
'tab' => [
'#type' => 'link',
'#title' => t('GDPR'),
// Task module adds in the URL.
'#url' => '',
'#attributes' => [
'title' => t('GDPR'),
'class' => ['toolbar-icon', 'toolbar-icon-shortcut'],
],
],
'tray' => [
'links' => [
'#theme' => 'links',
'#links' => [],
'#attributes' => [
'class' => ['toolbar-menu'],
],
],
],
'#weight' => -10,
'#attached' => [
'library' => [
'shortcut/drupal.shortcut',
],
],
];

}
return $items;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
uuid: 3b601cf3-2f83-4b18-a271-3025a16db2ad
langcode: en
status: true
dependencies:
config:
- field.storage.message.agreed
- message.template.consent_agreement_accepted
id: message.consent_agreement_accepted.agreed
field_name: agreed
entity_type: message
bundle: consent_agreement_accepted
label: Agreed
description: ''
required: false
translatable: false
default_value:
-
value: 0
default_value_callback: ''
settings:
on_label: 'Yes'
off_label: 'No'
field_type: boolean
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
uuid: 000c8918-277d-4444-8dac-922d86366238
langcode: en
status: true
dependencies:
config:
- field.storage.message.agreement
- message.template.consent_agreement_accepted
module:
- entity_reference_revisions
id: message.consent_agreement_accepted.agreement
field_name: agreement
entity_type: message
bundle: consent_agreement_accepted
label: Agreement
description: ''
required: false
translatable: false
default_value: { }
default_value_callback: ''
settings:
handler: 'default:gdpr_consent_agreement'
handler_settings:
target_bundles: null
sort:
field: _none
auto_create: false
field_type: entity_reference_revisions
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
uuid: a6562ec7-6913-4944-9fec-ab9ef0ab2bb1
langcode: en
status: true
dependencies:
config:
- field.storage.message.notes
- message.template.consent_agreement_accepted
id: message.consent_agreement_accepted.notes
field_name: notes
entity_type: message
bundle: consent_agreement_accepted
label: Notes
description: ''
required: false
translatable: false
default_value: { }
default_value_callback: ''
settings: { }
field_type: string_long
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
uuid: 2a6fc21e-93cb-4db8-96a0-7d1f77efc3d1
langcode: en
status: true
dependencies:
config:
- field.storage.message.user
- message.template.consent_agreement_accepted
id: message.consent_agreement_accepted.user
field_name: user
entity_type: message
bundle: consent_agreement_accepted
label: User
description: ''
required: false
translatable: false
default_value: { }
default_value_callback: ''
settings:
handler: 'default:user'
handler_settings: { }
field_type: entity_reference
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
uuid: 9168354c-5505-495d-bfce-382aa4f12be7
langcode: en
status: true
dependencies:
config:
- field.storage.message.user_accepted
- message.template.consent_agreement_accepted
id: message.consent_agreement_accepted.user_accepted
field_name: user_accepted
entity_type: message
bundle: consent_agreement_accepted
label: 'User Accepted'
description: ''
required: false
translatable: false
default_value: { }
default_value_callback: ''
settings:
handler: 'default:user'
handler_settings:
include_anonymous: true
filter:
type: _none
target_bundles: null
sort:
field: _none
auto_create: false
field_type: entity_reference
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
langcode: en
status: true
dependencies:
module:
- message
id: message.agreed
field_name: agreed
entity_type: message
type: boolean
settings:
case_sensitive: false
module: core
locked: false
cardinality: 1
translatable: true
indexes: { }
persist_with_no_fields: false
custom_storage: false
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
uuid: 83ca8ca3-88c0-4eb4-bdbf-cadb24186abf
langcode: en
status: true
dependencies:
module:
- entity_reference_revisions
- gdpr_consent
- message
id: message.agreement
field_name: agreement
entity_type: message
type: entity_reference_revisions
settings:
target_type: gdpr_consent_agreement
module: entity_reference_revisions
locked: false
cardinality: 1
translatable: true
indexes: { }
persist_with_no_fields: false
custom_storage: false
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
uuid: 24feee44-56c7-4e92-b4d2-fe51c5bf710d
langcode: en
status: true
dependencies:
module:
- message
id: message.notes
field_name: notes
entity_type: message
type: string_long
settings:
case_sensitive: false
module: core
locked: false
cardinality: 1
translatable: true
indexes: { }
persist_with_no_fields: false
custom_storage: false
20 changes: 20 additions & 0 deletions modules/gdpr_consent/config/install/field.storage.message.user.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
uuid: 4bcd4001-6d9c-4928-845a-ec518697c55b
langcode: en
status: true
dependencies:
module:
- message
- user
id: message.user
field_name: user
entity_type: message
type: entity_reference
settings:
target_type: user
module: core
locked: false
cardinality: 1
translatable: true
indexes: { }
persist_with_no_fields: false
custom_storage: false
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
uuid: b457e6e8-cf95-493e-b25a-8248bc60449f
langcode: en
status: true
dependencies:
module:
- message
- user
id: message.user_accepted
field_name: user_accepted
entity_type: message
type: entity_reference
settings:
target_type: user
module: core
locked: false
cardinality: 1
translatable: true
indexes: { }
persist_with_no_fields: false
custom_storage: false
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
uuid: a020749c-7309-4278-9fbf-4d1edfdafd51
langcode: en
status: true
dependencies: { }
template: consent_agreement_accepted
label: 'GDPR Consent Agreement'
description: ''
text:
-
value: "<p>Agreement: <a href=\"[message:agreement:entity:url]/revisions/[message:agreement:target_revision_id]/view\">[message:agreement:entity:title]</a><br />\r\nAgreed: [message:agreed]<br />\r\nNotes: [message:notes]</p>\r\n"
format: full_html
settings:
'token options':
clear: false
'token replace': true
purge_override: true
purge_methods: { }
Loading