| 1 |
Description
|
| 2 |
===========
|
| 3 |
Elements intends to become a library that provides complex form elements for developers to use in their modules.
|
| 4 |
|
| 5 |
Written by Heine Deelstra.
|
| 6 |
|
| 7 |
This module was commissioned by the NCRV (http://www.ncrv.nl/).
|
| 8 |
|
| 9 |
Elements provided
|
| 10 |
=================
|
| 11 |
|
| 12 |
1. tableselect
|
| 13 |
2. imagebutton (not working properly yet).
|
| 14 |
|
| 15 |
|
| 16 |
1. tableselect
|
| 17 |
===============
|
| 18 |
Provides a table with checkboxes or radios in the first column (similar to the table on admin/user/user).
|
| 19 |
|
| 20 |
$header = array(
|
| 21 |
'field_key' => 'field_title',
|
| 22 |
'field_key1' => 'field_title1',
|
| 23 |
);
|
| 24 |
|
| 25 |
$options = array(
|
| 26 |
'id1'=> array(
|
| 27 |
'field_key' => 'value',
|
| 28 |
'field_key1' => 'another value',
|
| 29 |
),
|
| 30 |
|
| 31 |
'id2'=> array(
|
| 32 |
'field_key' => 'value',
|
| 33 |
'field_key1' => 'another value',
|
| 34 |
),
|
| 35 |
);
|
| 36 |
|
| 37 |
$form['test_multiselect'] = array(
|
| 38 |
'#type'=> 'tableselect',
|
| 39 |
'#header' => $header,
|
| 40 |
'#options'=> $options,
|
| 41 |
'#default_value'=> array('id1' => ''),
|
| 42 |
);
|
| 43 |
|
| 44 |
|
| 45 |
$form['test_single_select'] = array(
|
| 46 |
'#type'=> 'tableselect',
|
| 47 |
'#header' => $header,
|
| 48 |
'#options'=> $options,
|
| 49 |
'#multiple' => FALSE,
|
| 50 |
'#default_value'=> 'id1',
|
| 51 |
);
|
| 52 |
|
| 53 |
Properties tableselect
|
| 54 |
======================
|
| 55 |
#header
|
| 56 |
The table header, an array of field_key => title pairs.
|
| 57 |
#options
|
| 58 |
The data displayed in the table. Nested array of id => array pairs where the array is an array of field_key => value pairs.
|
| 59 |
#multiple
|
| 60 |
Determines whether multiple values can be selected. Displays checkboxes when TRUE, radios when FALSE.
|
| 61 |
Default: TRUE
|
| 62 |
#advanced_select
|
| 63 |
Whether to provide advanced selection behaviour (SELECT ALL checkbox, SHIFT-select).
|
| 64 |
Default: TRUE - when #multiple is TRUE.
|
| 65 |
When #multiple is FALSE, always FALSE.
|
| 66 |
#default_value
|
| 67 |
Provide an array of id => x pairs for the ids that should be selected by default when #multiple is TRUE.
|
| 68 |
Provide the id as a scalar for the id that should be selected by default when #multiple is FALSE.
|