-
Notifications
You must be signed in to change notification settings - Fork 0
/
imagecache_ui.module
160 lines (148 loc) · 5.58 KB
/
imagecache_ui.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
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
<?php
/**
* Administrative interface to imagecache.
*
*/
/**
* Implementation of hook_help().
*/
function imagecache_ui_help($path, $arg) {
switch($path) {
case 'admin/build/imagecache':
return t('Manage ImageCache presets.');
case 'admin/build/imagecache/%/export':
return t('Place the following snippet in your module as part of <code>hook_imagecache_default_presets()</code>.');
}
}
/**
* Implementation of hook_menu().
*/
function imagecache_ui_menu() {
$items = array();
$items['admin/build/imagecache'] = array(
'title' => 'ImageCache',
'file' => 'imagecache_ui.pages.inc',
'description' => 'Administer imagecache presets and actions.',
'page callback' => 'imagecache_ui_preset_overview',
'access arguments' => array('administer imagecache'),
);
$items['admin/build/imagecache/list'] = array(
'title' => 'List',
'type' => MENU_DEFAULT_LOCAL_TASK,
'weight' => -10,
);
$items['admin/build/imagecache/add'] = array(
'title' => 'Add new preset',
'file' => 'imagecache_ui.pages.inc',
'page callback' => 'drupal_get_form',
'page arguments' => array('imagecache_ui_preset_form'),
'access arguments' => array('administer imagecache'),
'type' => MENU_LOCAL_TASK,
);
$items['admin/build/imagecache/%imagecache_ui_preset'] = array(
'title callback' => 'imagecache_preset_title_callback',
'title arguments' => array('Edit preset: !presetname', 3),
'file' => 'imagecache_ui.pages.inc',
'page callback' => 'drupal_get_form',
'page arguments' => array('imagecache_ui_preset_form', 3),
'access arguments' => array('administer imagecache'),
'type' => MENU_CALLBACK,
);
$items['admin/build/imagecache/%imagecache_ui_preset/delete'] = array(
'title callback' => 'imagecache_preset_title_callback',
'title arguments' => array('Delete preset: !presetname', 3),
'file' => 'imagecache_ui.pages.inc',
'page callback' => 'drupal_get_form',
'page arguments' => array('imagecache_ui_preset_delete_form', 3),
'access arguments' => array('administer imagecache'),
'type' => MENU_CALLBACK,
);
$items['admin/build/imagecache/%imagecache_ui_preset/flush'] = array(
'title callback' => 'imagecache_preset_title_callback',
'title arguments' => array('Flush preset: !presetname', 3),
'file' => 'imagecache_ui.pages.inc',
'page callback' => 'drupal_get_form',
'page arguments' => array('imagecache_ui_preset_flush_form', 3),
'access arguments' => array('flush imagecache'),
'type' => MENU_CALLBACK,
);
$items['admin/build/imagecache/%imagecache_ui_preset/export'] = array(
'title callback' => 'imagecache_preset_title_callback',
'title arguments' => array('Export preset: !presetname', 3),
'file' => 'imagecache_ui.pages.inc',
'page callback' => 'drupal_get_form',
'page arguments' => array('imagecache_ui_preset_export_form', 3),
'access arguments' => array('administer imagecache'),
'type' => MENU_CALLBACK,
);
$items['admin/build/imagecache/%imagecache_ui_preset/override'] = array(
'title callback' => 'imagecache_preset_title_callback',
'title arguments' => array('Override preset: !presetname', 3),
'file' => 'imagecache_ui.pages.inc',
'page callback' => 'drupal_get_form',
'page arguments' => array('imagecache_ui_preset_form', 3, TRUE),
'access arguments' => array('administer imagecache'),
'type' => MENU_CALLBACK,
);
$items['admin/build/imagecache/%imagecache_ui_preset/add/%'] = array(
'title callback' => 'imagecache_preset_title_callback',
'title arguments' => array('Add !actionname to !presetname', 3, 5),
'file' => 'imagecache_ui.pages.inc',
'page callback' => 'imagecache_ui_action_add_page',
'page arguments' => array(3, 5),
'access arguments' => array('administer imagecache'),
'type' => MENU_CALLBACK,
);
$items['admin/build/imagecache/%imagecache_ui_preset/%imagecache_action'] = array(
'title callback' => 'imagecache_preset_title_callback',
'title arguments' => array('!action for preset !presetname', 3, 4),
'file' => 'imagecache_ui.pages.inc',
'page callback' => 'drupal_get_form',
'page arguments' => array('imagecache_ui_action_form', 3, 4),
'access arguments' => array('administer imagecache'),
'type' => MENU_CALLBACK,
);
$items['admin/build/imagecache/%imagecache_ui_preset/%imagecache_action/delete'] = array(
'title callback' => 'imagecache_preset_title_callback',
'title arguments' => array('Delete !action for preset !presetname', 3, 4),
'file' => 'imagecache_ui.pages.inc',
'page callback' => 'drupal_get_form',
'page arguments' => array('imagecache_ui_action_delete_form', 3, 4),
'access arguments' => array('administer imagecache'),
'type' => MENU_CALLBACK,
);
return $items;
}
/**
* Menu wildcard loader.
*/
function imagecache_ui_preset_load($preset_id) {
return imagecache_preset($preset_id, TRUE);
}
function imagecache_preset_title_callback($title, $preset = array(), $action = array()) {
$replacements = array();
if (!empty($preset)) {
$replacements['!presetname'] = $preset['presetname'];
$replacements['!presetid'] = $preset['presetid'];
}
if (!empty($action) && !is_array($action)) {
$replacements['!actionname'] = $action;
}
elseif (!empty($action)) {
$replacements['!action'] = $action['action'];
}
return t($title, $replacements);
}
/**
* Implementation of hook_theme().
*/
function imagecache_ui_theme() {
return array(
'imagecache_ui_preset_actions' => array(
'arguments' => array(
'form' => NULL,
),
'file' => 'imagecache_ui.pages.inc',
),
);
}