webform_hints.admin.inc in Webform Hints 6
Same filename and directory in other branches
Admin page callbacks for the Webform Hints module.
File
webform_hints.admin.incView source
<?php
/**
* @file
* Admin page callbacks for the Webform Hints module.
*/
/**
* Menu callback; displays the Webform hints module settings page.
*
* @ingroup forms
* @see webform_hints_admin_settings_submit()
*/
function webform_hints_admin_settings(&$form_state) {
// Query the database for all webform nodes.
$options = array();
$result = db_query('SELECT w.nid, n.title FROM webform w, node n WHERE w.nid = n.nid');
while ($webform = db_fetch_object($result)) {
// dsm($webform);
$options[$webform->nid] = $webform->title;
}
// Build checkbox list of results with ability to apply/remove Webform Hints.
$form['webform_hints_forms'] = array(
'#type' => 'checkboxes',
'#title' => t('Webforms'),
'#default_value' => variable_get('webform_hints_forms', array()),
'#options' => $options,
'#description' => t('Select the webform nodes you would like to apply the "Webform Hints" effect to. On the selected nodes, the titles of textfields, textareas, and email fields will appear as placeholder text within the respective fields. The labels of these fields will be visible only to screenreaders.'),
);
$form['submit'] = array(
'#type' => 'submit',
'#value' => t('Save configuration'),
);
return $form;
}
/**
* Form submission handler for webform_hints_admin_settings().
*
* @see webform_hints_admin_settings()
*/
function webform_hints_admin_settings_submit($form, &$form_state) {
variable_set('webform_hints_forms', $form_state['values']['webform_hints_forms']);
drupal_set_message(t('The Webform Hints settings were saved.'), 'status');
}
Functions
Name![]() |
Description |
---|---|
webform_hints_admin_settings | Menu callback; displays the Webform hints module settings page. |
webform_hints_admin_settings_submit | Form submission handler for webform_hints_admin_settings(). |