forked from dmoses/islandora_accordion_rotator_module
-
Notifications
You must be signed in to change notification settings - Fork 0
/
accordion_rotator.module
112 lines (107 loc) · 3.49 KB
/
accordion_rotator.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
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
<?php
/**
* @file
* A block module that displays images from a list of PID's
* in an interactive accordion rotator. Based off Accordion Rotator v1.0.
*/
/**
* Implements hook_help().
*
* Displays help and module information.
*/
function accordion_rotator_help($path, $arg) {
if ($path == 'admin/help#accordion_rotator') {
return '<p>' . t("Displays images including a user selected list of PID's for display on the frontpage accordion rotator") . '</p>';
}
}
/**
* Implements hook_menu().
*/
function accordion_rotator_menu() {
$items = array();
$items['accordion_rotator/setup'] = array(
'page callback' => 'accordion_rotator_canvas_setup',
'access arguments' => array('view accordion_rotator'),
'type' => MENU_CALLBACK,
'file' => 'includes/utils.inc',
);
$items['admin/config/content/accordion_rotator'] = array(
'title' => 'Accordion Rotator Configuration',
'description' => 'Configuration for The Accordion Rotator module',
'page callback' => 'drupal_get_form',
'page arguments' => array('accordion_rotator_form'),
'access arguments' => array('access administration pages'),
'file' => 'includes/utils.inc',
'type' => MENU_NORMAL_ITEM,
);
return $items;
}
/**
* Implements hook_permission().
*/
function accordion_rotator_permission() {
return array(
'view accordion_rotator' => array(
'title' => t('View Accordion Rotator Content'),
'description' => t('Access Accordion Rotator')));
}
/**
* Implements hook_block_info().
*/
function accordion_rotator_block_info() {
$blocks['accordion_rotator'] = array(
'info' => t('Accordion rotator'),
'cache' => DRUPAL_CACHE_PER_ROLE,
);
return $blocks;
}
/**
* Implements hook_block_view().
*/
function accordion_rotator_block_view($delta = '') {
$block = array();
switch ($delta) {
case 'accordion_rotator':
$block['subject'] = t('Block Name');
$block['content'] = array(
'#markup' => theme('accordion_rotator_view'),
'#attached' => array(
'css' => array(
drupal_get_path('module', 'accordion_rotator') . '/css/main.css',
drupal_get_path('module', 'accordion_rotator') . '/css/fonts.css',
drupal_get_path('module', 'accordion_rotator') . '/css/accordion.css',
),
'js' => array(
drupal_get_path('module', 'accordion_rotator') . '//jquery/jquery-1.6.2.min.js',
drupal_get_path('module', 'accordion_rotator') . '/js/resize.js',
drupal_get_path('module', 'accordion_rotator') . '/js/script.js',
drupal_get_path('module', 'accordion_rotator') . '/js/accordion.js',
drupal_get_path('module', 'accordion_rotator') . '/js/pngFixer.js',
drupal_get_path('module', 'accordion_rotator') . '/js/buttons.js',
),
),
);
// This settings variable is used in the js/accordion.js file to get the
// path for the left/right buttons.//
$my_settings = array(
'linkpath' => url(drupal_get_path('module', 'accordion_rotator')),
);
drupal_add_js(array('accordion_rotator' => $my_settings), 'setting');
break;
}
return $block;
}
/**
* Implements hook_theme().
*/
function accordion_rotator_theme($existing, $type, $theme, $path) {
return array(
'accordion_rotator_view' => array(
'template' => 'theme/accordion-rotator',
'variables' => array(
'domain_url' => url(drupal_get_path('module', 'accordion_rotator')),
'block_data' => array(),
),
),
);
}