function clientside_validation_general_settings_form in Clientside Validation 7.2
Same name and namespace in other branches
- 7 clientside_validation.admin.inc \clientside_validation_general_settings_form()
@file Admin settings for Clientside Validation
1 string reference to 'clientside_validation_general_settings_form'
- clientside_validation_menu in ./
clientside_validation.module - Implements hook_menu().
File
- ./
clientside_validation.admin.inc, line 7 - Admin settings for Clientside Validation
Code
function clientside_validation_general_settings_form($form_id, $form_state) {
drupal_set_title(t('Edit general settings'));
//jquery.validate.js settings
$form['clientside_validation_min'] = array(
'#type' => 'fieldset',
'#collapsible' => TRUE,
'#collapsed' => FALSE,
'#title' => t('Use minified version of jquery.validate.js'),
'#description' => t('You can use the minified version of the library.'),
);
$form['clientside_validation_min']['clientside_validation_use_minified'] = array(
'#type' => 'radios',
'#options' => array(
'1' => t('Yes'),
'0' => t('No'),
),
'#default_value' => variable_get('clientside_validation_use_minified', 0),
'#title' => t('Use minified version?'),
);
//jquery.form.js settings
$form['clientside_validation_jquery_form'] = array(
'#type' => 'fieldset',
'#collapsible' => TRUE,
'#collapsed' => FALSE,
'#title' => t('Override the version of jquery.form.js'),
'#description' => t('This is needed for IE < 9 support for #ajax forms.'),
);
$form['clientside_validation_jquery_form']['clientside_validation_override_jquery_form'] = array(
'#type' => 'radios',
'#options' => array(
'1' => t('Yes'),
'0' => t('No'),
),
'#default_value' => variable_get('clientside_validation_override_jquery_form', 0),
'#title' => t('Use jquery.form.js version 3.09 (16-APR-2012)?'),
);
//Page settings
$form['clientside_validation_pages'] = array(
'#type' => 'fieldset',
'#collapsible' => TRUE,
'#collapsed' => FALSE,
'#title' => t('Paths'),
'#description' => t('Include or exclude paths for Clientside Validation.'),
);
$form['clientside_validation_pages']['clientside_validation_filter_paths'] = array(
'#type' => 'radios',
'#options' => array(
CLIENTSIDE_VALIDATION_EXCLUDE_PATHS => t('Add Clientside Validation on all paths except those specified below'),
CLIENTSIDE_VALIDATION_INCLUDE_PATHS => t('Only add Clientside Validation on the paths specified below'),
),
'#default_value' => variable_get('clientside_validation_filter_paths', CLIENTSIDE_VALIDATION_EXCLUDE_PATHS),
'#title' => t('Include or exclude paths'),
);
$form['clientside_validation_pages']['clientside_validation_path_list'] = array(
'#type' => 'textarea',
'#default_value' => variable_get('clientside_validation_path_list', 'admin/structure/views/view/*'),
'#title' => t("Enter paths"),
'#description' => t("Enter one page per line as Drupal paths.\n The '*' character is a wildcard. Example paths are %blog for the blog page and\n %blog-wildcard for every personal blog. %front is the front page.", array(
'%blog' => 'blog',
'%blog-wildcard' => 'blog/*',
'%front' => '<front>',
)),
);
//Form settings
$form['clientside_validation_validate_forms'] = array(
'#type' => 'fieldset',
'#collapsible' => TRUE,
'#collapsed' => FALSE,
'#title' => t('Forms to validate'),
);
$form['clientside_validation_validate_forms']['clientside_validation_validate_all'] = array(
'#type' => 'radios',
'#default_value' => variable_get('clientside_validation_validate_all', CLIENTSIDE_VALIDATION_VALIDATE_ALL),
'#title' => t('Select the forms to validate'),
'#options' => array(
CLIENTSIDE_VALIDATION_VALIDATE_ALL => t('Validate all forms'),
CLIENTSIDE_VALIDATION_VALIDATE_SPECIFIC => t('Only validate forms listed below'),
CLIENTSIDE_VALIDATION_VALIDATE_ALL_EXCEPT => t('Validate all forms except those listed below'),
),
);
$form['clientside_validation_validate_forms']['clientside_validation_validate_specific'] = array(
'#type' => 'textarea',
'#default_value' => variable_get('clientside_validation_validate_specific', ''),
'#title' => t("Enter form IDs below"),
'#description' => t('You can specify form IDs (one per line, use _) of forms that should or should not be validated.'),
'#states' => array(
'invisible' => array(
'input[name="clientside_validation_validate_all"]' => array(
'value' => (string) CLIENTSIDE_VALIDATION_VALIDATE_ALL,
),
),
),
);
if (module_exists('xregexp_api')) {
$lib = libraries_detect('xregexp');
if ($lib && $lib['installed']) {
//XRegExp settings
$form['clientside_validation_xregxp'] = array(
'#type' => 'fieldset',
'#collapsible' => TRUE,
'#collapsed' => FALSE,
'#title' => t('XRegExp for Pattern matching'),
'#description' => t("Javascript doesn't support regular expressions for\n pattern matching the way PHP does. With the XRegExp library most PHP\n expressions(pregex) become also available in Javascript. So you might\n want to use that instead of AJAX calls."),
);
$form['clientside_validation_xregxp']['clientside_validation_usexregxp'] = array(
'#prefix' => '<br />',
'#title' => t('Use XRegExp'),
'#description' => t('Check to use XRegExp for PCRE.'),
'#type' => 'checkbox',
'#default_value' => variable_get('clientside_validation_usexregxp', 0),
);
$options = array(
'' => t('default'),
);
foreach ($lib['variants'] as $name => $variant) {
if (!isset($variant['error']) || !$variant['error']) {
$options[$name] = $name;
}
}
$form['clientside_validation_xregxp']['clientside_validation_xregxp_variant'] = array(
'#title' => t('XRegExp variant'),
'#description' => t('Choose which variant of the library you want to use.'),
'#type' => 'select',
'#options' => $options,
'#default_value' => variable_get('clientside_validation_xregxp_variant', ''),
);
}
}
$form = system_settings_form($form);
return $form;
}