I have the following code.
function mymodule_menu() {
$items = array();
$items['mymodules/page'] = array(
'title' => t('my module settings'),
'description' => t('change values here'),
'page callback' => 'mymodule_page',
//'page arguments' => array('mymodule_page'),
'access arguments' => array('access administration pages'),
'type' => MENU_CALLBACK,
);
return $items;
}
function mymodule_page() {
return drupal_get_form('test_form');
}
function test_form() {
$form = array();
$brandarray = array('nokia','siemes');
$form['mymodule_brand'] = array(
'#type' => 'select',
'#title' => t('Brand'),
'#default_value' => variable_get('mymodule_brand', 'nokia'),
'#options' => $brandarray,
'#description' => t('Change this.'),
);
$form['my_markup'] = array(
'#markup' => '<p>Lorem ipsum</p>',
);
return system_settings_form($form);
}
This works perfectly. What I wanted to so is returning a form and page content together, i.e after the page content, in a menu callback function; I tried using the following code:
function mymodule_page() {
$variable = drupal_get_form('test_form');
$variable .= '<div class="newclass">here</div>';
return $variable;
}
But it prints something like the following:
Array here
How do I return both the form and content together in a menu callback?
test_form()
aretest_form($form, &$form_state)
; you should then remove the$form = array()
line from that form builder. See Form generation.