function certificate_form_alter in Certificate 3.x
Same name and namespace in other branches
- 8.3 certificate.module \certificate_form_alter()
- 6.2 certificate.module \certificate_form_alter()
- 6 certificate.module \certificate_form_alter()
- 7.3 certificate.module \certificate_form_alter()
- 7.2 certificate.module \certificate_form_alter()
Implements hook_form_alter().
Add certifiable checkbox to a content type.
File
- ./
certificate.module, line 265 - Certificate module.
Code
function certificate_form_alter(&$form, &$form_state, $form_id) {
if ($form_id == 'node_type_form') {
$form['certificate'] = array(
'#type' => 'fieldset',
'#title' => 'Certificate settings',
'#collapsed' => TRUE,
'#collapsible' => TRUE,
'#group' => 'additional_settings',
);
$form['certificate']['certificate_certifiable'] = array(
'#type' => 'checkbox',
'#title' => 'Award certificate',
'#description' => t('Make this content type certificate-enabled. Certificate mapping selections will show on the node form.'),
'#default_value' => variable_get("certificate_certifiable_{$form['#node_type']->type}", 0),
);
if ($form['#node_type']->type == 'certificate') {
$form['#after_build'][] = 'certificate_warn_course_content';
}
}
}