Révision c304a780
Ajouté par Assos Assos il y a environ 6 ans
drupal7/sites/all/modules/ctools/stylizer/plugins/export_ui/stylizer_ui.class.php | ||
---|---|---|
5 | 5 |
*/ |
6 | 6 |
class stylizer_ui extends ctools_export_ui { |
7 | 7 |
|
8 |
function access($op, $item) { |
|
8 |
|
|
9 |
public function access($op, $item) { |
|
9 | 10 |
$access = parent::access($op, $item); |
10 | 11 |
if ($op == 'add' && $access && empty($this->base_types)) { |
11 |
// Make sure there are base styles defined. |
|
12 |
$access = FALSE; |
|
12 |
// Make sure there are base styles defined.
|
|
13 |
$access = FALSE;
|
|
13 | 14 |
} |
14 | 15 |
return $access; |
15 | 16 |
} |
16 | 17 |
|
17 |
function list_form(&$form, &$form_state) { |
|
18 |
|
|
19 |
public function list_form(&$form, &$form_state) { |
|
18 | 20 |
ctools_include('stylizer'); |
19 | 21 |
parent::list_form($form, $form_state); |
20 | 22 |
|
... | ... | |
60 | 62 |
); |
61 | 63 |
} |
62 | 64 |
|
63 |
function list_sort_options() { |
|
65 |
|
|
66 |
public function list_sort_options() { |
|
64 | 67 |
return array( |
65 | 68 |
'disabled' => t('Enabled, title'), |
66 | 69 |
'title' => t('Title'), |
... | ... | |
71 | 74 |
); |
72 | 75 |
} |
73 | 76 |
|
74 |
function list_filter($form_state, $item) { |
|
77 |
|
|
78 |
public function list_filter($form_state, $item) { |
|
75 | 79 |
if (empty($form_state['style_plugins'][$item->settings['style_base']])) { |
76 | 80 |
$this->style_plugin = array( |
77 | 81 |
'name' => 'broken', |
... | ... | |
102 | 106 |
return parent::list_filter($form_state, $item); |
103 | 107 |
} |
104 | 108 |
|
105 |
function list_search_fields() { |
|
109 |
|
|
110 |
public function list_search_fields() { |
|
106 | 111 |
$fields = parent::list_search_fields(); |
107 | 112 |
$fields[] = 'plugin_title'; |
108 | 113 |
return $fields; |
109 | 114 |
} |
110 | 115 |
|
111 |
function list_build_row($item, &$form_state, $operations) { |
|
112 |
// Set up sorting |
|
116 |
|
|
117 |
public function list_build_row($item, &$form_state, $operations) { |
|
118 |
// Set up sorting. |
|
113 | 119 |
switch ($form_state['values']['order']) { |
114 | 120 |
case 'disabled': |
115 | 121 |
$this->sorts[$item->name] = empty($item->disabled) . $item->admin_title; |
116 | 122 |
break; |
123 |
|
|
117 | 124 |
case 'title': |
118 | 125 |
$this->sorts[$item->name] = $item->admin_title; |
119 | 126 |
break; |
127 |
|
|
120 | 128 |
case 'name': |
121 | 129 |
$this->sorts[$item->name] = $item->name; |
122 | 130 |
break; |
131 |
|
|
123 | 132 |
case 'type': |
124 | 133 |
$this->sorts[$item->name] = $this->style_plugin['type'] . $item->admin_title; |
125 | 134 |
break; |
135 |
|
|
126 | 136 |
case 'base': |
127 | 137 |
$this->sorts[$item->name] = $this->style_plugin['title'] . $item->admin_title; |
128 | 138 |
break; |
139 |
|
|
129 | 140 |
case 'storage': |
130 | 141 |
$this->sorts[$item->name] = $item->type . $item->admin_title; |
131 | 142 |
break; |
... | ... | |
154 | 165 |
); |
155 | 166 |
} |
156 | 167 |
|
157 |
function list_table_header() { |
|
168 |
|
|
169 |
public function list_table_header() { |
|
158 | 170 |
return array( |
159 | 171 |
array('data' => t('Type'), 'class' => array('ctools-export-ui-type')), |
160 | 172 |
array('data' => t('Name'), 'class' => array('ctools-export-ui-name')), |
... | ... | |
165 | 177 |
); |
166 | 178 |
} |
167 | 179 |
|
168 |
function init($plugin) { |
|
180 |
|
|
181 |
public function init($plugin) { |
|
169 | 182 |
ctools_include('stylizer'); |
170 | 183 |
$this->base_types = ctools_get_style_base_types(); |
171 | 184 |
|
172 | 185 |
parent::init($plugin); |
173 | 186 |
} |
174 | 187 |
|
175 |
function get_wizard_info(&$form_state) { |
|
188 |
|
|
189 |
public function get_wizard_info(&$form_state) { |
|
176 | 190 |
$form_info = parent::get_wizard_info($form_state); |
177 | 191 |
ctools_include('stylizer'); |
178 | 192 |
|
... | ... | |
219 | 233 |
* The stylizer wizard stores its stuff in slightly different places, so |
220 | 234 |
* we have to find it and move it to the right place. |
221 | 235 |
*/ |
222 |
function store_stylizer_info(&$form_state) { |
|
236 |
public function store_stylizer_info(&$form_state) {
|
|
223 | 237 |
/* |
224 | 238 |
foreach (array('name', 'admin_title', 'admin_description') as $key) { |
225 | 239 |
if (!empty($form_state['values'][$key])) { |
... | ... | |
235 | 249 |
$form_state['item']->settings['name'] = $form_state['item']->name; |
236 | 250 |
} |
237 | 251 |
|
238 |
function edit_wizard_next(&$form_state) { |
|
252 |
|
|
253 |
public function edit_wizard_next(&$form_state) { |
|
239 | 254 |
$this->store_stylizer_info($form_state); |
240 | 255 |
parent::edit_wizard_next($form_state); |
241 | 256 |
} |
242 | 257 |
|
243 |
function edit_wizard_finish(&$form_state) { |
|
258 |
|
|
259 |
public function edit_wizard_finish(&$form_state) { |
|
244 | 260 |
// These might be stored by the stylizer wizard, so we should clear them. |
245 | 261 |
if (isset($form_state['settings']['old_settings'])) { |
246 | 262 |
unset($form_state['settings']['old_settings']); |
... | ... | |
249 | 265 |
parent::edit_wizard_finish($form_state); |
250 | 266 |
} |
251 | 267 |
|
252 |
function edit_form_type(&$form, &$form_state) { |
|
268 |
|
|
269 |
public function edit_form_type(&$form, &$form_state) { |
|
253 | 270 |
foreach ($this->base_types as $module => $info) { |
254 | 271 |
foreach ($info as $key => $base_type) { |
255 | 272 |
$types[$module . '-' . $key] = $base_type['title']; |
... | ... | |
266 | 283 |
); |
267 | 284 |
} |
268 | 285 |
|
269 |
function edit_form_type_submit(&$form, &$form_state) { |
|
286 |
|
|
287 |
public function edit_form_type_submit(&$form, &$form_state) { |
|
270 | 288 |
list($form_state['item']->style_module, $form_state['item']->style_type) = explode('-', $form_state['values']['type']); |
271 | 289 |
} |
290 |
|
|
272 | 291 |
} |
Formats disponibles : Unified diff
Weekly update of contrib modules