· 8 years ago · Apr 13, 2018, 06:02 PM
1<?php
2// $Id: views_ui.module,v 1.44.2.21 2007/05/05 02:40:18 merlinofchaos Exp $
3
4// ---------------------------------------------------------------------------
5// Drupal Hooks
6
7/*
8 * Implementation of hook_help()
9 */
10function views_ui_help($section) {
11 switch ($section) {
12 case 'admin/help#views_ui':
13 return _views_ui_help_add();
14 case 'admin/build/views/import':
15 return t('You may import a view by cut-and-pasting the results of an export view. If the import is successful you will be taken to the Add View page with all of the settings of the imported view..');
16 case 'admin/build/views':
17 return t('This screen shows all of the views that are currently defined in your system. The default views are provided by Views and other modules and are automatically available. If a customized view of the same name exists, it will be used in place of a default view.');
18 }
19 if (!strncmp($section, 'admin/build/views', 11)) {
20 switch (arg(2)) {
21 case 'add':
22 case 'edit':
23 return t('Please see !s or the views documentation on drupal.org for help here.', array('!s' => l(t('the views help page'), 'admin/help/views_ui')));
24 case 'export':
25 return t('You may cut & paste this view into an import function on another system. The view will only work if all modules required by the view are installed on the target location.');
26 }
27 }
28}
29
30/*
31 * Because the add/edit page is kind of complicated.
32 */
33function _views_ui_help_add() {
34 $output = t('<p>A view retrieves some number of nodes from the database and displays them in a variety of formats.</p>');
35 $output .= t("<h3>View Types</h3>
36 <dl>
37 <dt><em>List View</em></dt><dd>A List View provides the data for each node retrieved in the form of an unordered list. Each item in the Fields section will be displayed; the Title will be displayed as a label. The order the items appear in the Fields list is the order the items will appear in the output. Leaving the title blank will cause the field to appear with no label (which is desirable in lists that just display titles, for example).</dd>
38 <dt><em>Table View</em></dt><dd>A Table View provides the data for each node as one row of a table. The Fields selected in the Fields list will be displayed in the order they are listed. The title column will be shown in the header. If you set the field to 'sortable' then the header will be click-sortable; be careful here as click-sorts will be processed after built-in sort criteria, and built-in sort criteria can easily make click-sorts invalid. If using click-sorts, choose a field to be the default sort; otherwise the first field presented will be the default sort.</dd>
39 <dt><em>Teaser List</em></dt><dd>A Teaser List will simply present the teaser of each node retrieved.</dd>
40 <dt><em>Full Nodes</em></dt><dd>This will show the full content of each node retrieved.</dd>
41 <dt><em>Random Teaser</em></dt><dd>This will show a single random teaser.</dd>
42 <dt><em>Random Node</em></dt><dd>This will show a single random node's full view.</dd>
43 </dl>");
44
45 views_load_cache();
46 $output .= t("<h3>Fields</h3>\n");
47 $output .= t("<p>When using List or Table view, it is necessary to choose which fields will be displayed to the user.</p><dl>\n");
48 $fields = _views_get_fields();
49 foreach ($fields as $field) {
50 $output .= "<dt><em>$field[name]</em></dt><dd>$field[help]</dd>\n";
51 }
52 $output .= "</dl>\n";
53
54 $output .= t("<h3>Arguments</h3>\n");
55 $output .= t("<p>Arguments can be passed to the View through the URL, in order to create views that are configurable by the user. This is very useful to create views for taxonomy, or to sort by user. When using arguments, substitution is performed on the title. %1 will represent argument 1, %2 will represent argument 2. Each argument has a title field; this title is used if providing a summary view (which can matter because the argument is missing which could result in confusing phrases such as 'view for')</p><dl>\n");
56 $arguments = _views_get_arguments();
57 foreach ($arguments as $argument) {
58 $output .= "<dt><em>$argument[name]</em></dt><dd>$argument[help]</dd>\n";
59 }
60 $output .= "</dl>\n";
61
62 $output .= t("<h3>Filters</h3>\n");
63 $output .= t("<p>Views may be filtered to restrict the view on a number of criteria.</p><dl>\n");
64 $filters = _views_get_filters();
65 foreach ($filters as $filter) {
66 $output .= "<dt><em>$filter[name]</em></dt><dd>$filter[help]</dd>\n";
67 }
68 $output .= "</dl>\n";
69
70 $output .= t("<h3>Sorting Critera</h3>\n");
71 $output .= t("<p>The result set may be sorted on any of the following criteria.</p><dl>\n");
72 $sorts = _views_get_sorts();
73 foreach ($sorts as $sort) {
74 $output .= "<dt><em>$sort[name]</em></dt><dd>$sort[help]</dd>\n";
75 }
76 $output .= "</dl>\n";
77
78 return $output;
79}
80
81/*
82 * Implementation of hook_perm()
83 */
84function views_ui_perm() {
85 return array('administer views');
86}
87
88/*
89 * Implementation of hook_menu()
90 */
91function views_ui_menu($may_cache) {
92 $items = array();
93
94 if ($may_cache) {
95 $items[] = array('path' => 'admin/build/views',
96 'title' => t('Views'),
97 'callback' => 'views_ui_admin_page',
98 'access' => user_access('administer views'),
99 'description' => t('Views are customized lists of content on your system; they are highly configurable and give you control over how lists of content are presented.'),
100 'type' => MENU_NORMAL_ITEM);
101 $items[] = array('path' => 'admin/build/views/list',
102 'title' => t('List'),
103 'callback' => 'views_ui_admin_page',
104 'access' => user_access('administer views'),
105 'type' => MENU_DEFAULT_LOCAL_TASK,
106 'weight' => '-1');
107 $items[] = array('path' => 'admin/build/views/add',
108 'title' => t('Add'),
109 'callback' => 'views_ui_admin_add_page',
110 'access' => user_access('administer views'),
111 'type' => MENU_LOCAL_TASK);
112 $items[] = array('path' => 'admin/build/views/import',
113 'title' => t('Import'),
114 'callback' => 'views_ui_admin_import_page',
115 'access' => user_access('administer views'),
116 'type' => MENU_LOCAL_TASK);
117 $items[] = array('path' => 'admin/build/views/tools',
118 'title' => t('Tools'),
119 'callback' => 'drupal_get_form',
120 'callback arguments' => array('views_ui_admin_tools'),
121 'access' => user_access('administer views'),
122 'type' => MENU_LOCAL_TASK);
123 $items[] = array('path' => 'admin/build/views/delete',
124 'title' => t('Edit view'),
125 'callback' => 'drupal_get_form',
126 'callback arguments' => array('views_ui_admin_delete_confirm'),
127 'access' => user_access('administer views'),
128 'type' => MENU_CALLBACK);
129 $items[] = array('path' => 'admin/build/views/enable',
130 'callback' => 'views_ui_admin_enable_page',
131 'access' => user_access('administer views'),
132 'type' => MENU_CALLBACK);
133 $items[] = array('path' => 'admin/build/views/disable',
134 'callback' => 'views_ui_admin_disable_page',
135 'access' => user_access('administer views'),
136 'type' => MENU_CALLBACK);
137 }
138 else {
139 if (user_access('administer views') &&
140 arg(0) == 'admin' &&
141 arg(1) == 'build' &&
142 arg(2) == 'views') {
143 $view = views_load_view(arg(3));
144 if ($view) {
145 views_ui_add_menu_items($items, $view, 'admin/build/views/' . arg(3), TRUE);
146 }
147 }
148 }
149 return $items;
150}
151
152function views_ui_add_menu_items(&$items, $view, $url, $base = TRUE, $args = array()) {
153 if (user_access('administer views')) {
154 if ($base) {
155 // we also have to add the administrative 'view' of the view in some
156 // cases
157 $items[] = array('path' => $url,
158 'title' => t('View'),
159 'callback' => 'views_view_page',
160 'callback arguments' => array_merge(array($view->name), $args),
161 'access' => user_access('administer views'),
162 'type' => MENU_CALLBACK);
163 }
164 $items[] = array('path' => "$url/view",
165 'title' => t('View'),
166 'callback' => 'views_page',
167 'callback arguments' => array_merge(array($view->name), $args),
168 'access' => user_access('administer views'),
169 'weight' => -10,
170 'type' => MENU_DEFAULT_LOCAL_TASK);
171 if (isset($view->is_default)) {
172 $items[] = array('path' => "$url/add",
173 'title' => t('Override'),
174 'callback' => 'views_ui_admin_add_page',
175 'callback arguments' => array($view->name),
176 'access' => user_access('administer views'),
177 'weight' => -5,
178 'type' => MENU_LOCAL_TASK);
179 }
180 else {
181 $items[] = array('path' => "$url/edit",
182 'title' => t('Edit'),
183 'callback' => 'views_ui_admin_edit_page',
184 'callback arguments' => array($view->name),
185 'access' => user_access('administer views'),
186 'weight' => -5,
187 'type' => MENU_LOCAL_TASK);
188 }
189 $items[] = array('path' => "$url/export",
190 'title' => t('Export'),
191 'callback' => 'drupal_get_form',
192 'callback arguments' => array('views_ui_admin_export_page', $view->name),
193 'access' => user_access('administer views'),
194 'type' => MENU_LOCAL_TASK);
195 $items[] = array('path' => "$url/clone",
196 'title' => t('Clone'),
197 'callback' => 'views_ui_admin_clone_page',
198 'callback arguments' => array($view->name),
199 'access' => user_access('administer views'),
200 'type' => MENU_LOCAL_TASK);
201 }
202}
203
204// ---------------------------------------------------------------------------
205// Administrative Pages
206
207/*
208 * This page lists all system views and provides links to edit them.
209 */
210function views_ui_admin_page() {
211 views_load_cache();
212
213 $numViews = 25;
214
215 drupal_set_title(t('Administer views'));
216
217 $result = pager_query("SELECT vid, name, description, menu_title, page_title, block_title, url, page, menu, block FROM {view_view} ORDER BY name", $numViews);
218
219 while ($view = db_fetch_object($result)) {
220 $url = ($view->page ? l($view->url, $view->url) : t('No Page View'));
221 $provides = array();
222 if ($view->page) {
223 $provides[] = 'Page';
224 }
225 if ($view->block) {
226 $provides[] = 'Block';
227 }
228 if ($view->menu) {
229 $provides[] = 'Menu';
230 }
231
232 $items[] = array(
233 $view->name,
234 filter_xss_admin(views_get_title($view, 'admin')),
235 $view->description,
236 implode(', ', $provides),
237 $url,
238 theme('links', array(
239 array('title' => t('Edit'), 'href' => "admin/build/views/$view->name/edit"),
240 array('title' => t('Export'), 'href' => "admin/build/views/$view->name/export"),
241 array('title' => t('Delete'), 'href' => "admin/build/views/delete/$view->vid"),
242 array('title' => t('Clone'), 'href' => "admin/build/views/$view->name/clone"),
243 ))
244 );
245 }
246
247 if ($items) {
248 $output = theme('table', array(t('View'), t('Title'), t('Description'), t('Provides'), t('URL'), t('Actions')), $items, array("cellpadding" => "4"), t('Existing Views'));
249 $output .= theme('pager', NULL, $numViews);
250 }
251 else {
252 $output .= t('<p>No views have currently been defined.</p>');
253 }
254
255 $result = db_query("SELECT name FROM {view_view}");
256 while ($view = db_fetch_object($result)) {
257 $used[$view->name] = true;
258 }
259
260 $output .= t('<p>Below are system default views; if you edit one of these, a view will be created that will override any system use of the view.</p>');
261 $items = array();
262 $default_views = _views_get_default_views();
263
264 $views_status = variable_get('views_defaults', array());
265
266 foreach ($default_views as $view) {
267 $url = ($view->page ? l($view->url, $view->url) : t('No Page View'));
268
269 if ($used[$view->name]) {
270 $status = t('Overridden');
271 }
272 else if (isset($views_status[$view->name])) {
273 if ($views_status[$view->name] == 'enabled') {
274 $status = t('Enabled');
275 }
276 else {
277 $status = t('Disabled');
278 }
279 }
280 else if ($view->disabled) {
281 $status = t('Disabled');
282 }
283 else {
284 $status = t('Enabled');
285 }
286
287 $provides = array();
288 if ($view->page) {
289 $provides[] = t('Page');
290 }
291 if ($view->block) {
292 $provides[] = t('Block');
293 }
294 if ($view->menu) {
295 $provides[] = t('Menu');
296 }
297
298 $links = array();
299 $links[] = array('title' => t('Add'), 'href' => "admin/build/views/add/$view->name");
300 if ($status == t('Enabled')) {
301 $links[] = array('title' => t('Disable'), 'href' => "admin/build/views/disable/$view->name");
302 }
303 else if ($status == t('Disabled')) {
304 $links[] = array('title' => t('Enable'), 'href' => "admin/build/views/enable/$view->name");
305 }
306
307 $items[] = array(
308 $view->name,
309 filter_xss_admin(views_get_title($view, 'menu')),
310 $view->description,
311 implode(', ', $provides),
312 $url,
313 $status,
314 theme('links', $links)
315 );
316 }
317
318 if ($items) {
319 $output .= theme('table', array(t('Default view'), t('Title'), t('Description'), t('Provides'), t('URL'), t('Status'), t('Actions')), $items, array("cellpadding" => "4"), t('Default Views'));
320 }
321 else {
322 $output .= t('<p>No views have currently been defined.</p>');
323 }
324
325 return $output;
326}
327
328function views_ui_admin_tools() {
329 $form['markup'] = array(
330 '#value' => t('<p>Occasionally, something or other can cause the Views cache to contain stale data; this is particularly true after module updates and sometimes true after taxonomy and profile updates. If you are having problems with Views creating malformed queries, the first thing you should always do is clear the Views cache to see if that is the problem.</p>'),
331 );
332
333 $form['clear'] = array(
334 '#type' => 'submit',
335 '#value' => t('Clear views cache'),
336 );
337
338 return $form;
339}
340
341function views_ui_admin_tools_submit($form_id, $form) {
342 if ($_POST['op'] == t('Clear views cache')) {
343 views_invalidate_cache();
344 drupal_set_message("The Views cache has been cleared.");
345 }
346}
347
348/*
349 * Page to enable a disabled default view
350 */
351function views_ui_admin_enable_page($view = '') {
352 views_load_cache();
353
354 if ($view) {
355 $views_status = variable_get('views_defaults', array());
356 $views_status[$view] = 'enabled';
357 variable_set('views_defaults', $views_status);
358 menu_rebuild();
359 }
360 drupal_goto('admin/build/views');
361}
362
363/*
364 * Page to disable an enabled default view
365 */
366function views_ui_admin_disable_page($view = '') {
367 views_load_cache();
368
369 if ($view) {
370 $views_status = variable_get('views_defaults', array());
371 $views_status[$view] = 'disabled';
372 variable_set('views_defaults', $views_status);
373 menu_rebuild();
374 }
375 drupal_goto('admin/build/views');
376}
377
378/*
379 * Provide a textarea to paste a view export into.
380 */
381function views_ui_admin_import_page() {
382 views_load_cache();
383
384 if ($_POST['form_id'] == 'views_edit_view') {
385 return views_ui_admin_add_page();
386 }
387 drupal_set_title("Import a View");
388
389 return drupal_get_form('views_ui_admin_import', $form);
390}
391
392function views_ui_admin_import() {
393 $form['view'] = array(
394 '#type' => 'textarea',
395 '#title' => t('Import View Code'),
396 '#cols' => 60,
397 '#rows' => 6,
398 '#description' => t('Cut and paste the results of an Export View here.'),
399 );
400
401 $form['submit'] = array(
402 '#type' => 'submit',
403 '#value' => t("Submit"),
404 );
405
406 $form['#redirect'] = NULL;
407 return $form;
408}
409
410/*
411 * Handle the submit button on importing a view.
412 */
413function views_ui_admin_import_submit($formid, $form) {
414 views_load_cache();
415 ob_start();
416 eval($form['view']);
417 ob_end_clean();
418
419 $tables = array_keys(_views_get_tables());
420 if (isset($view)) {
421 if (!is_array($view->requires) || !array_diff($view->requires, $tables)) {
422 views_sanitize_view($view);
423 drupal_set_title(t('Add a View'));
424 $output = drupal_get_form('views_edit_view', $view, NULL);
425 print theme('page', $output);
426 exit;
427 }
428 else {
429 drupal_set_message(t("You don't seem to have the following requirements: ") . implode(', ', array_diff($view->requires, $tables)));
430 }
431 }
432 else {
433 drupal_set_message(t('Unable to get a view out of that.'));
434 }
435}
436
437/*
438 * Export a view for cut & paste.
439 */
440function views_ui_admin_export_page($vid = '') {
441 views_load_cache();
442
443 $code = views_create_view_code($vid);
444 $lines = substr_count($code, "\n");
445 $form['code'] = array(
446 '#type' => 'textarea',
447 '#title' => $view->name,
448 '#default_value' => $code,
449 '#rows' => $lines);
450 return $form;
451}
452
453/*
454 * Provide a form to add a view. Allow adding a view from default templates.
455 */
456function views_ui_admin_add_page($template = NULL) {
457 views_load_cache();
458
459 $op = $_POST['op'];
460 if ($op == t('Cancel')) {
461 drupal_goto('admin/build/views');
462 }
463
464 $view = _views_get_default_view($template);
465
466 drupal_set_title(t('Add a View'));
467
468 return drupal_get_form('views_edit_view', $view, $op);
469}
470
471/*
472 * Provide a form to clone a view.
473 */
474function views_ui_admin_clone_page($viewname) {
475 views_load_cache();
476
477 $op = $_POST['op'];
478 if ($op == t('Cancel')) {
479 drupal_goto('admin/build/views');
480 }
481
482 $view = views_get_view($viewname);
483 if (!$view) {
484 return drupal_not_found();
485 }
486
487 unset($view->vid);
488 drupal_set_title(t('Add a View'));
489
490 return drupal_get_form('views_edit_view', $view, $op);
491}
492
493/*
494 * Provide a form to edit a view.
495 */
496function views_ui_admin_edit_page($vid = '') {
497 views_load_cache();
498
499 $op = $_POST['op'];
500 if ($op == t('Cancel')) {
501 drupal_goto('admin/build/views');
502 }
503
504 if ($op == t('Delete')) {
505 drupal_goto("admin/build/views/delete/$vid");
506 }
507
508 if (!($view = _views_load_view($vid))) {
509 drupal_goto('admin/build/views');
510 }
511
512 drupal_set_title(t('Edit view %n', array('%n' => $view->name)));
513 return drupal_get_form('views_edit_view', $view, $op);
514}
515
516/*
517 * Provide a form to confirm deletion of a view.
518 */
519function views_ui_admin_delete_confirm($vid = '') {
520 $view = _views_load_view($vid);
521
522 if (!$view) {
523 return drupal_goto('admin/build/views');
524 }
525
526 $form['vid'] = array('#type' => 'value', '#value' => $view->vid);
527// bdragon note: Did you mean to drop the above line on the floor with this?
528 $form = confirm_form($form,
529 t('Are you sure you want to delete %title?', array('%title' => $view->name)),
530 $_GET['destination'] ? $_GET['destination'] : 'admin/build/views',
531 t('This action cannot be undone.'),
532 t('Delete'), t('Cancel')
533 );
534 return $form;
535}
536
537/*
538 * Handle the submit button to delete a view.
539 */
540function views_ui_admin_delete_confirm_submit($form_id, $form) {
541 _views_delete_view((object) $form);
542 menu_rebuild();
543 drupal_goto('admin/build/views');
544}
545
546/*
547 * Get an empty view with basic defaults.
548 */
549function _views_get_default_view($template = '') {
550 if ($template) {
551 $default_views = _views_get_default_views();
552 if (isset($default_views[$template])) {
553 $view = $default_views[$template];
554 }
555 }
556 if (!$view) {
557 $view = new stdClass();
558 $view->use_pager = true;
559 $view->nodes_per_page = variable_get('default_nodes_main', 10);
560 $view->page_header_format = variable_get('filter_default_format', 1);
561 $view->page_footer_format = variable_get('filter_default_format', 1);
562 $view->page_header_format = variable_get('filter_default_format', 1);
563 $view->block_header_format = variable_get('filter_default_format', 1);
564 $view->block_footer_format = variable_get('filter_default_format', 1);
565 $view->block_header_format = variable_get('filter_default_format', 1);
566 $view->vid = 0;
567 }
568
569 return _views_check_arrays($view);
570}
571
572// ---------------------------------------------------------------------------
573// Select Box Definitions
574
575// These should probably have string array keys that are easier to identify.
576
577/**
578 * Select box entries for argument defaults.
579 */
580function _views_get_arguments_default() {
581 return array(
582 1 => t('Return Page Not Found'),
583 2 => t('Display All Values'),
584 3 => t('Summary, unsorted'),
585 4 => t('Summary, sorted ascending'),
586 5 => t('Summary, sorted descending'),
587 6 => t('Summary, sorted as view'),
588 7 => t('Use Empty Text'),
589 );
590}
591
592/**
593 * Select box entries for sort ordering.
594 */
595function _views_sortorders() {
596 return array(
597 'ASC' => t('Ascending'),
598 'DESC' => t('Descending')
599 );
600}
601
602/**
603 * Swap two items in an array.
604 */
605function _views_swap(&$arr, $a, $b) {
606 $temp = $arr[$a];
607 $arr[$a] = $arr[$b];
608 $arr[$b] = $temp;
609}
610
611/**
612 * Move an item up in an array.
613 */
614function _views_move_up(&$arr, $i) {
615 if ($i <= 0 || $i >= count($arr)) {
616 return; // can't do it.
617 }
618 _views_swap($arr, $i - 1, $i);
619}
620
621/**
622 * Move an item down in an array.
623 */
624function _views_move_down(&$arr, $i) {
625 if ($i >= count($arr) - 1 || $i < 0) {
626 return; // can't do it.
627 }
628 _views_swap($arr, $i + 1, $i);
629}
630
631/**
632 * Move an item to the front of an array.
633 */
634function _views_move_top(&$arr, $i) {
635 if ($i <= 0 || $i >= count($arr)) {
636 return; // can't do it.
637 }
638 $temp = $arr[$i];
639 for ($x = $i; $x > 0; $x--)
640 $arr[$x] = $arr[$x - 1];
641 $arr[0] = $temp;
642}
643
644/**
645 * Move an item to the end of an array.
646 */
647function _views_move_bottom(&$arr, $i) {
648 $end = count($arr) - 1;
649 if ($i >= $end || $i < 0) {
650 return; // can't do it.
651 }
652 $temp = $arr[$i];
653 for ($x = $i; $x < $end; $x++)
654 $arr[$x] = $arr[$x + 1];
655 $arr[$end] = $temp;
656}
657
658/**
659 * Figure out which of the many, many buttons on a form were clicked and
660 * handle it.
661 */
662function _views_check_sub_ops(&$form, &$order, $i) {
663
664 if ($form['delete']['#value']) {
665 unset($form['delete']['#value']);
666 unset($order[$i]);
667 $order = array_values($order); // reindex
668 $form['delete']['#printed'] = true;
669 $form['up']['#printed'] = true;
670 $form['down']['#printed'] = true;
671 $form['top']['#printed'] = true;
672 $form['bottom']['#printed'] = true;
673 return 'delete';
674 }
675 else foreach (array('up', 'down', 'top', 'bottom') as $dir) {
676 if ($form[$dir]['#value']) {
677 unset ($form[$dir]['#value']);
678 $func = "_views_move_$dir";
679 $func($order, $i);
680 return true;
681 }
682 }
683 return false;
684}
685
686/**
687 * Figure out if one of the add buttons on a form were clicked, and handle it.
688 */
689function _views_check_ops(&$view, $op, $form) {
690 if ($op == t('Add Filter')) {
691 $view->new_filter['id'] = $form['filter']['add']['id']['#value'];
692 return 'filter';
693 }
694 else if ($op == t('Add Criteria')) {
695 $view->new_sort['id'] = $form['sort']['add']['id']['#value'];
696 return 'sort';
697 }
698 else if ($op == t('Add Argument')) {
699 $view->new_argument['id'] = $form['argument']['add']['id']['#value'];
700 return 'argument';
701 }
702 else if ($op == t('Add Field')) {
703 $fieldbits = explode('.', $form['field']['add']['id']['#value']);
704 $view->new_field['id'] = $form['field']['add']['id']['#value'];
705 $view->new_field['tablename'] = $fieldbits[0];
706 $view->new_field['field'] = $fieldbits[1];
707 $view->new_field['queryname'] = "$fieldbits[0]_$fieldbits[1]";
708 return 'field';
709 }
710 else if ($op == t('Expose Filter')) {
711 $view->new_exposed_filter['id'] = $form['exposed_filter']['add']['id']['#value'];
712 return 'filter';
713 }
714}
715
716/**
717 * Custom form element to do our nice images.
718 */
719function views_elements() {
720 $type['views_imagebutton'] = array('#input' => TRUE, '#button_type' => 'submit',);
721 return $type;
722}
723
724function theme_views_imagebutton($element) {
725 return '<input type="image" class="form-'. $element['#button_type'] .'" name="'. $element['#name'] .'" value="'. check_plain($element['#default_value']) .'" '. drupal_attributes($element['#attributes']) . ' src="' . $element['#image'] . '" alt="' . $element['#title'] . '" title="' . $element['#title'] . "\" />\n";
726}
727
728function views_imagebutton_value() {
729 // null function guarantees default_value doesn't get moved to #value.
730}
731
732/**
733 * Set up the dynamic #options on a widget
734 */
735f