function terms_of_use_js in Terms of Use 7
Same name and namespace in other branches
- 6 terms_of_use.pages.inc \terms_of_use_js()
Menu callback for AHAH addition.
1 string reference to 'terms_of_use_js'
- terms_of_use_admin_settings in ./
terms_of_use.admin.inc - Menu callback; show settings form.
File
- ./
terms_of_use.admin.inc, line 125 - Page callbacks for the Terms of Use module.
Code
function terms_of_use_js($form, &$form_state) {
// Build the new form.
$form_build_id = $_POST['form_build_id'];
if (isset($form['terms_of_use_text']['terms_of_use_node_title'])) {
// Create the extra field.
$form['terms_of_use_text']['terms_of_use_node_id'] = array(
'#type' => 'textfield',
'#title' => t('Node id where your Terms of Use are published'),
'#default_value' => variable_get('terms_of_use_node_id', ''),
'#description' => t('Node <em>id</em> of the page or story (or blog entry or book page) where your Terms of Use are published.'),
);
unset($form['terms_of_use_text']['terms_of_use_node_title']);
$form['terms_of_use_text']['terms_of_use_pick_node_id']['#value'] = t('I prefer to provide the title of the post');
}
else {
// Create the extra field.
$form['terms_of_use_text']['terms_of_use_node_title'] = array(
'#type' => 'textfield',
'#title' => t('Title of the post where your Terms of Use are published'),
'#default_value' => variable_get('terms_of_use_node_title', ''),
'#description' => t('Node <em>title</em> of the page or story (or blog entry or book page) where your Terms of Use are published.'),
'#autocomplete_path' => 'terms_of_use/autocomplete',
);
unset($form['terms_of_use_text']['terms_of_use_node_id']);
$form['terms_of_use_text']['terms_of_use_pick_node_id']['#value'] = t('I prefer to specify the node id');
}
// Rebuild the form.
// @todo: Resolve the bug when user click node_id button and then cannot return back to node_title field.
$form = form_builder($form_build_id, $form, $form_state);
form_set_cache($form_build_id, $form, $form_state);
return $form['terms_of_use_text'];
}