latest Ukrainian translation from L.D.O
[project/imagecache.git] / imagecache_ui.module
CommitLineData
6cf0c855
DP
1<?php
2// $Id$
3
4/**
5 * Administrative interface to imagecache.
6 *
7 */
8
6624dc14 9/**
10 * Implementation of hook_help().
11 */
8c361d7c
DP
12function imagecache_ui_help($path, $arg) {
13 switch($path) {
6624dc14 14 case 'admin/build/imagecache':
15 return t('Manage ImageCache presets.');
16 case 'admin/build/imagecache/%/export':
17 return t('Place the following snippet in your module as part of <code>hook_imagecache_default_presets()</code>.');
6cf0c855
DP
18 }
19}
20
6624dc14 21/**
22 * Implementation of hook_menu().
23 */
8c361d7c 24function imagecache_ui_menu() {
6cf0c855 25 $items = array();
8c361d7c 26 $items['admin/build/imagecache'] = array(
e1bc2b25 27 'title' => 'ImageCache',
a699da53 28 'file' => 'imagecache_ui.pages.inc',
8c361d7c 29 'description' => 'Administer imagecache presets and actions.',
a699da53 30 'page callback' => 'imagecache_ui_preset_overview',
8c361d7c
DP
31 'access arguments' => array('administer imagecache'),
32 );
33 $items['admin/build/imagecache/list'] = array(
34 'title' => 'List',
35 'type' => MENU_DEFAULT_LOCAL_TASK,
36 'weight' => -10,
37 );
67ee60c4 38
8c361d7c
DP
39 $items['admin/build/imagecache/add'] = array(
40 'title' => 'Add new preset',
a699da53 41 'file' => 'imagecache_ui.pages.inc',
8c361d7c 42 'page callback' => 'drupal_get_form',
14f444ba 43 'page arguments' => array('imagecache_ui_preset_form'),
8c361d7c
DP
44 'access arguments' => array('administer imagecache'),
45 'type' => MENU_LOCAL_TASK,
46 );
47
8def98ce 48 $items['admin/build/imagecache/%imagecache_ui_preset'] = array(
8c361d7c 49 'title callback' => 'imagecache_preset_title_callback',
8def98ce 50 'title arguments' => array('Edit preset: !presetname', 3),
a699da53 51 'file' => 'imagecache_ui.pages.inc',
8c361d7c 52 'page callback' => 'drupal_get_form',
8def98ce 53 'page arguments' => array('imagecache_ui_preset_form', 3),
8c361d7c
DP
54 'access arguments' => array('administer imagecache'),
55 'type' => MENU_CALLBACK,
56 );
8def98ce 57 $items['admin/build/imagecache/%imagecache_ui_preset/delete'] = array(
8c361d7c 58 'title callback' => 'imagecache_preset_title_callback',
8def98ce 59 'title arguments' => array('Delete preset: !presetname', 3),
a699da53 60 'file' => 'imagecache_ui.pages.inc',
8c361d7c 61 'page callback' => 'drupal_get_form',
8def98ce 62 'page arguments' => array('imagecache_ui_preset_delete_form', 3),
8c361d7c
DP
63 'access arguments' => array('administer imagecache'),
64 'type' => MENU_CALLBACK,
65 );
8def98ce 66 $items['admin/build/imagecache/%imagecache_ui_preset/flush'] = array(
8c361d7c 67 'title callback' => 'imagecache_preset_title_callback',
8def98ce 68 'title arguments' => array('Flush preset: !presetname', 3),
a699da53 69 'file' => 'imagecache_ui.pages.inc',
8c361d7c 70 'page callback' => 'drupal_get_form',
8def98ce 71 'page arguments' => array('imagecache_ui_preset_flush_form', 3),
8c361d7c
DP
72 'access arguments' => array('flush imagecache'),
73 'type' => MENU_CALLBACK,
74 );
6624dc14 75 $items['admin/build/imagecache/%imagecache_ui_preset/export'] = array(
76 'title callback' => 'imagecache_preset_title_callback',
77 'title arguments' => array('Export preset: !presetname', 3),
a699da53 78 'file' => 'imagecache_ui.pages.inc',
6624dc14 79 'page callback' => 'drupal_get_form',
80 'page arguments' => array('imagecache_ui_preset_export_form', 3),
81 'access arguments' => array('administer imagecache'),
82 'type' => MENU_CALLBACK,
83 );
84 $items['admin/build/imagecache/%imagecache_ui_preset/override'] = array(
85 'title callback' => 'imagecache_preset_title_callback',
86 'title arguments' => array('Override preset: !presetname', 3),
a699da53 87 'file' => 'imagecache_ui.pages.inc',
6624dc14 88 'page callback' => 'drupal_get_form',
89 'page arguments' => array('imagecache_ui_preset_form', 3, TRUE),
90 'access arguments' => array('administer imagecache'),
91 'type' => MENU_CALLBACK,
92 );
8c361d7c 93
b409d664 94 $items['admin/build/imagecache/%imagecache_ui_preset/add/%'] = array(
8c361d7c 95 'title callback' => 'imagecache_preset_title_callback',
8def98ce 96 'title arguments' => array('Add !actionname to !presetname', 3, 5),
a699da53 97 'file' => 'imagecache_ui.pages.inc',
a86a1067 98 'page callback' => 'imagecache_ui_action_add_page',
99 'page arguments' => array(3, 5),
8c361d7c
DP
100 'access arguments' => array('administer imagecache'),
101 'type' => MENU_CALLBACK,
102 );
103
8def98ce 104 $items['admin/build/imagecache/%imagecache_ui_preset/%imagecache_action'] = array(
8c361d7c 105 'title callback' => 'imagecache_preset_title_callback',
8def98ce 106 'title arguments' => array('!action for preset !presetname', 3, 4),
a699da53 107 'file' => 'imagecache_ui.pages.inc',
8c361d7c 108 'page callback' => 'drupal_get_form',
8def98ce 109 'page arguments' => array('imagecache_ui_action_form', 3, 4),
8c361d7c
DP
110 'access arguments' => array('administer imagecache'),
111 'type' => MENU_CALLBACK,
112 );
113
b409d664 114 $items['admin/build/imagecache/%imagecache_ui_preset/%imagecache_action/delete'] = array(
8c361d7c 115 'title callback' => 'imagecache_preset_title_callback',
b409d664 116 'title arguments' => array('Delete !action for preset !presetname', 3, 4),
a699da53 117 'file' => 'imagecache_ui.pages.inc',
8c361d7c 118 'page callback' => 'drupal_get_form',
b409d664 119 'page arguments' => array('imagecache_ui_action_delete_form', 3, 4),
8c361d7c
DP
120 'access arguments' => array('administer imagecache'),
121 'type' => MENU_CALLBACK,
122 );
6cf0c855
DP
123 return $items;
124}
125
a699da53 126/**
127 * Menu wildcard loader.
128 */
129function imagecache_ui_preset_load($preset_id) {
130 return imagecache_preset($preset_id, TRUE);
131}
132
8c361d7c
DP
133function imagecache_preset_title_callback($title, $preset = array(), $action = array()) {
134 $replacements = array();
135 if (!empty($preset)) {
136 $replacements['!presetname'] = $preset['presetname'];
137 $replacements['!presetid'] = $preset['presetid'];
138 }
139 if (!empty($action) && !is_array($action)) {
140 $replacements['!actionname'] = $action;
141 }
142 elseif (!empty($action)) {
143 $replacements['!action'] = $action['action'];
144 }
145 return t($title, $replacements);
146}
147
148/**
149 * Implementation of hook_theme().
150 */
151function imagecache_ui_theme() {
152 return array(
8c361d7c
DP
153 'imagecache_ui_preset_actions' => array(
154 'arguments' => array(
155 'form' => NULL,
a699da53 156 ),
157 'file' => 'imagecache_ui.pages.inc',
42cc9535 158 ),
6cf0c855 159 );
42cc9535 160}
6cf0c855 161