Hi guys.
I´m creating a custom module, and I have a problem with a form rendered in a node (It' s a custom content type.). This is my code:
<?php
//This is a custom hook, rendered in a node after I created (in a custom content type):
function elements_choose($form, &$form_state, $node) {
$form_state['cache'] = TRUE;
if ($node->items) { //SQL query results, in hook_load...
if($node->help){
$form['item_description'] = array(
'#type' => 'markup',
'#markup' => t($node->help),
);
}
$form['item_container'] = array(
'#tree' => FALSE,
'#preffix' => '
',
'#suffix' => '
',
);
$i = 1;
$button_vote = drupal_get_path('module', 'items') . '/img/add.png';
foreach ($node->items as $i => $item) {
$name = $item['name'];
$description = $item['description'];
$iid = $item['iid'];
//Create a button and fieldset for each item:
$space = 'item' . $item['name']; //Creates the fieldset space...
$button = 'iid' . $item['iid']; // Creates the button ...
$info = 'info' . $iid;
//Fieldset for each item:
$form['item_container'][$space] = array(
'#tree' => FALSE,
'#type' => 'fieldset',