-
Notifications
You must be signed in to change notification settings - Fork 0
/
idc_defaults.module
64 lines (58 loc) · 2.13 KB
/
idc_defaults.module
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
<?php
/**
* @file
* Defines hooks used for JHU's iDC integration.
*/
use Drupal\Core\Entity\EntityTypeInterface;
/**
* Implements hook_entity_bundle_field_info_alter().
*/
function idc_defaults_entity_bundle_field_info_alter(&$fields, EntityTypeInterface $entity_type, $bundle) {
if (isset($fields['field_member_of'])) {
$fields['field_member_of']->addConstraint('WorkbenchAccess');
}
if (isset($fields['field_access_terms'])) {
$fields['field_access_terms']->addConstraint('WorkbenchSections');
}
}
/**
* Implements hook_field_widget_info_alter().
*/
function idc_defaults_field_widget_info_alter(array &$info) {
// Allow the idc_unique field to use the normal string_textfield widget as
// opposed to defining its own empty extension of it.
$info['string_textfield']['field_types'][] = 'idc_unique';
}
/**
* Implements hook_field_formatter_info_alter().
*/
function idc_defaults_field_formatter_info_alter(array &$info) {
$info['string']['field_types'][] = 'idc_unique';
}
/**
* Implements hook_plugin_filter_condition plugin
*
* Filters conditions out of the google tag manager form. The google
* tag manager from does not need these and they will cause problems if
* they do exist there.
*
* This was borrowed from https://github.com/Islandora/documentation/issues/1887,
* though I added in a couple (one that was specific to our setup).
*/
function idc_defaults_plugin_filter_condition__google_tag_alter(&$definitions, array $extra) {
unset($definitions['content_entity_type']);
unset($definitions['file_uses_filesystem']);
unset($definitions['media_has_mimetype']);
unset($definitions['media_source_mimetype']);
unset($definitions['media_has_term']);
unset($definitions['media_is_islandora_media']);
unset($definitions['media_uses_filesystem']);
unset($definitions['node_had_namespace']);
unset($definitions['node_has_parent']);
unset($definitions['node_has_term']);
unset($definitions['node_is_islandora_object']);
unset($definitions['node_referenced_by_node']);
unset($definitions['parent_node_has_term']);
unset($definitions['media_mediatype']);
unset($definitions['islandora_entity_bundle']);
}