| [ Index ] |
PHP Cross Reference of Drupal 6 (gatewave) |
[Summary view] [Print] [Text view]
1 $Id: README.txt,v 1.13 2010/08/30 05:21:19 mattyoung Exp $ 2 3 Extend form elements checkboxes & radios to display in multi-column 4 5 CCK support: 6 ----------- 7 CCK field Multicolumn support is built-in for the following: 8 9 Any text/integer/decimal/float field that uses the checkboxes, radios or select_or_other widget 10 content taxonomy 11 nodereference 12 userreference 13 14 the CCK field configuration screen will have the multicolumn settings. 15 16 More CCK widget type can be added in your site's settings.php by adding this like: 17 18 $conf['multicolumncheckboxesradios_extra_widget_types'] = array('some_cck_widget_type', 'some_more_cck_widget_type', 'etc'); 19 20 Attention: 'some_cck_widget_type' is not the form element type id, it's the key 21 returned by the HOOK_widget_info() hook. You have to look into the CCK widget module 22 to find this key. 23 24 Webforms Usage: 25 -------------- 26 See http://drupal.org/project/multicolumncheckboxesradios 27 or http://drupal.org/node/603900#comment-2228686 28 29 30 Code Usage: 31 ---------- 32 A new property '#multicolumn' can be specified to make checkboxes and radios 33 display in columns. This property takes an array with the following keys/values: 34 35 'width' => number (required): the number of column desired 36 'row-major' => TRUE (optional): go across the screen first, then down 37 'indent' => number (optional): number of space to indent the first row in columns 38 for row-major or number of rows for the first column 39 in column-major 40 'caption' => string (optional): table caption 41 'column-heading' => array (optional): specify the column heading as array of string 42 'row-heading' => array (optional): specify the row heading as array of string 43 44 In the definition of form element checkboxes/radios, add the '#multicolumn' property: 45 46 $form['multicolumn_checkboxes'] = array( 47 '#type' => 'checkboxes', 48 '#multicolumn' => array('width' => 3, 49 'caption' => 'December', 50 'column-heading' => array( 51 t('heading 1'), 52 t('heading 2'), 53 )), 54 . 55 . 56 . 57 ); 58 59 or 60 61 $form['multicolumn_checkboxes'] = array( 62 '#type' => 'checkboxes', 63 '#multicolumn' => array('width' => 5, 'row-major' => TRUE), 64 . 65 . 66 . 67 ); 68 69 70 Example: 71 72 4 checkboxes, set '#multicolumn' => array('width' => 3), it will be 73 shown in 3 columns: 74 75 A C D 76 B 77 78 set '#multicolumn' => array('width' => 3, 'row-major' => TRUE), it will be 79 80 A B C 81 D 82 83 WARNING: the column display is done by re-arranging the checkboxes/radios displayed into a HTML table. 84 The $form_state['values'][] array will not be in the same order as the '#options' array. If you want 85 to fetch checkbox state in the original '#options' order, iterate the $form_state['values'][] 86 array using the keys from '#options' array. 87 88 The markup is like this: 89 90 <table class="multicolumncheckboxesradios-table"> 91 <thead><tr> <!-- only exist if column headings are present --> 92 <th class="multicolumncheckboxesradios-heading-corner>...</th> <!-- this only exist if both column and row headings are present --> 93 <th class="multicolumncheckboxesradios-column-heading-first>...</th> 94 <th class="multicolumncheckboxesradios-column-heading>...</th> 95 ... 96 <th class="multicolumncheckboxesradios-column-heading multicolumncheckboxesradios-column-heading-last>...</th> 97 </tr></thead> 98 <tbody> 99 <tr class="odd"> 100 <td class="multicolumncheckboxesradios-row-heading">...</td> <!-- only exist if row headings are present --> 101 <td class="multicolumncheckboxesradios-column-first multicolumncheckboxesradios-column">...</td> 102 <td class="multicolumncheckboxesradios-column">...</td> 103 ... 104 <td class="multicolumncheckboxesradios-column multicolumncheckboxesradios-column-last">...</td> 105 </tr> 106 <tr class="even"> 107 <td class="multicolumncheckboxesradios-row-heading">...</td> 108 <td class="multicolumncheckboxesradios-column-first multicolumncheckboxesradios-column">...</td> 109 <td class="multicolumncheckboxesradios-column">...</td> 110 ... 111 <td class="multicolumncheckboxesradios-column multicolumncheckboxesradios-column-last">...</td> 112 </tr> 113 ... 114 </tbody> 115 </table>
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
| Generated: Thu Mar 24 11:18:33 2011 | Cross-referenced by PHPXref 0.7 |