I've made a module that displays every month with content, clicking on each month gives all the content of that month (works OK). Now I want a dropdownlist above that filled with every year with content. picture (via ImageShack) (I added the red border later for clarity).
The code I've made is ():
$select_elements = array('#size' => "", '#title' => "years", '#name' => "", '#value' => $selected_values,
'#id' => "mydropdown", '#attributes' => "", '#options' => $select_options, /* i.e. an array of [$year] = $year */
'#description' => "description", '#multiple' => FALSE, '#required' => FALSE);
/* --- */
$themed_dropdown_html = theme_select($select_elements); /* theme_select is described in form.inc */
$output .= $themed_dropdown_html; /* $output is added to the rest of the HTML to build the block */
It generates the HTML all right but I get warnings on the page:
* warning: implode() [function.implode]: Bad arguments. in C:\Program Files\xampp\htdocs\drupal-4.7.2\includes\form.inc on line 292.
* warning: implode() [function.implode]: Bad arguments. in C:\Program Files\xampp\htdocs\drupal-4.7.2\includes\form.inc on line 292.
Apart from those warnings it somehow feels like this is not 'the proper way' to do it.
- Am I using the right approach? How should it be done?