function simpletest_example_form in Examples for Developers 6
Same name and namespace in other branches
- 7 simpletest_example/simpletest_example.module \simpletest_example_form()
Implementation of hook_form().
Related topics
File
- simpletest_example/
simpletest_example.module, line 70 - An example of simpletest tests to accompany the tutorial at http://drupal.org/node/395012.
Code
function simpletest_example_form(&$node) {
$type = node_get_types('type', $node);
if ($type->has_title) {
$form['title'] = array(
'#type' => 'textfield',
'#title' => check_plain($type->title_label),
'#required' => TRUE,
'#default_value' => $node->title,
'#weight' => -5,
);
}
if ($type->has_body) {
$form['body_field'] = node_body_field($node, $type->body_label, $type->min_word_count);
}
return $form;
}