-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathting_dk5.module
More file actions
65 lines (59 loc) · 1.42 KB
/
ting_dk5.module
File metadata and controls
65 lines (59 loc) · 1.42 KB
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
65
<?php
/**
* @file
* Ting DK5 settings module.
*/
/**
* Implements hook_menu().
*/
function ting_dk5_menu() {
$items = array();
$items['admin/config/ting/dk5'] = array(
'title' => 'Ting DK5 Settings',
'description' => 'Configure DK5 settings.',
'page callback' => 'drupal_get_form',
'page arguments' => array('ting_dk5_settings'),
'access arguments' => array('administer ting_dk5 settings'),
'file' => 'ting_dk5.admin.inc',
);
return $items;
}
/**
* Implements hook_permission().
*/
function ting_dk5_permission() {
return array(
'administer ting_dk5 settings' => array(
'title' => t('Administer Ting DK5 settings'),
),
);
}
/**
* Implements hook_field_attach_view_alter().
*
* Hide existing DK5 fields on collection and item pages.
*/
function ting_dk5_field_attach_view_alter(&$output, $context) {
// Check if we have DK5 field.
if (empty($output['ting_details_classification'])) {
return;
}
$view_mode = $output['ting_details_classification']['#view_mode'];
// Check if it is a necessary view mode.
if (in_array(
$view_mode,
array(
'collection_primary',
'_custom_display',
'teaser',
)
)
) {
// If the box is unchecked remove the field to hide it.
$value = variable_get('ting_dk5_show_' . $view_mode, 1);
if ($value == 0) {
unset($output['ting_details_classification']);
}
}
}
include_once 'ting_dk5.features.inc';