/[drupal]/contributions/sandbox/jjeff/betterselect/betterselect.module
ViewVC logotype

Contents of /contributions/sandbox/jjeff/betterselect/betterselect.module

Parent Directory Parent Directory | Revision Log Revision Log | View Revision Graph Revision Graph


Revision 1.1 - (show annotations) (download) (as text)
Thu Sep 21 13:25:02 2006 UTC (3 years, 2 months ago) by jjeff
Branch: MAIN
CVS Tags: HEAD
File MIME type: text/x-php
A better user interface for SELECT form elements with multiple = TRUE
Currently requires patch #85166 in order to work properly.
1 <?php
2
3 function betterselect_elements() {
4 $type = array();
5 $type['select'] = array('#process' => array('betterselect_process' => array()));
6 return $type;
7 }
8
9 function betterselect_process($element) {
10 if ($element['#multiple']) {
11 $element['#type'] = 'checkboxes';
12 if ($element['#options'][0] == t('<none>')) {
13 unset($element['#options'][0]);
14 }
15 if(count($element['#options']) > 10) {
16 $fixheight = ' betterfixed';
17
18 }
19 unset($element['#theme']);
20 $element = expand_checkboxes($element);
21 $element['#prefix'] = "<div class=\"betterselect{$fixheight}\">". $element['#prefix'];
22 $element['#suffix'] .= '</div>';
23 static $path;
24 if (!isset($path)) {
25 $path = drupal_get_path('module', 'betterselect');
26 drupal_add_css($path .'/betterselect.css');
27 drupal_add_js($path .'/betterselect.js');
28 }
29 }
30 return $element;
31 }

  ViewVC Help
Powered by ViewVC 1.1.2