function certificate_form in Certificate 6.2
Same name and namespace in other branches
- 8.3 certificate.module \certificate_form()
- 6 certificate.module \certificate_form()
- 7.3 certificate.module \certificate_form()
- 7.2 certificate.module \certificate_form()
- 3.x certificate.module \certificate_form()
File
- ./
certificate.module, line 50 - Certificate module.
Code
function certificate_form(&$node, $form_state) {
// The site admin can decide if this node type has a title and body, and how
// the fields should be labeled. We need to load these settings so we can
// build the node form correctly.
$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) {
// In Drupal 6, we use node_body_field() to get the body and filter
// elements. This replaces the old textarea + filter_form() method of
// setting this up. It will also ensure the teaser splitter gets set up
// properly.
$form['body_field'] = node_body_field($node, $type->body_label, $type->min_word_count);
}
// Now we define the form elements specific to our node type.
$form['certificate']['#tree'] = TRUE;
$form['certificate']['orientation'] = array(
'#type' => 'radios',
'#title' => t('Orientation'),
'#default_value' => isset($node->certificate['orientation']) ? $node->certificate['orientation'] : '',
'#options' => array(
'portrait' => t('Portrait'),
'landscape' => t('Landscape'),
),
'#required' => TRUE,
'#description' => 'The orientation of the generated certificate.',
);
$form['options']['status']['#default_value'] = 0;
$form['options']['promote']['#default_value'] = 0;
return $form;
}