function quail_api_get_validation_methods in Quail API 7
Returns an array of validation methods that are supported.
A validation method is how the validation process is to be performed. Examples are:
- performing the validation everytime a page is viewed
- performing the validation only when a validate button is checked
This is mostly information. Extending modules are expected to provide the functionality that utilizes this data.
@todo function name, path, and arguments support should probably be added here.
Parameters
string|null $validation_method: (optional) A machine name representing of the validation method. When defined, the return value to only contain the validation method that matches the given id. When undefined, all validation methods will be loaded into the validation_method array.
Return value
array An array of validation methods that are supported by this module or extending modules. The array keys are the machine names for each display level.
1 call to quail_api_get_validation_methods()
- quail_api_get_validation_methods_list in ./
quail_api.module - Returns a list of validation methods.
1 string reference to 'quail_api_get_validation_methods'
- quail_api_reset_cache in ./
quail_api.module - Resets all static caches provided by this module.
File
- ./
quail_api.module, line 582 - Module file for the quail api.
Code
function quail_api_get_validation_methods($validation_method = NULL) {
$validation_methods =& drupal_static(__FUNCTION__, NULL);
if (!isset($validation_methods)) {
if ($cache = cache_get('quail_api_validation_methods')) {
$validation_methods = $cache->data;
}
}
if (isset($validation_methods)) {
if (!is_null($validation_method)) {
if (isset($validation_methods[$validation_method])) {
return $validation_methods[$validation_method];
}
return array();
}
return $validation_methods;
}
$validation_methods = array();
$validation_methods['quail_api_method_immediate'] = array(
'human_name' => t("Immediately Validate"),
'module' => 'quail_api',
'description' => t("Always perform the validation. Validation results are never saved."),
'database' => FALSE,
'automatic' => TRUE,
);
$validation_methods['quail_api_method_manual'] = array(
'human_name' => t("Manually Validate"),
'module' => 'quail_api',
'description' => t("Perform the validation only when requested. Validation results are never saved."),
'database' => FALSE,
'automatic' => FALSE,
);
$validation_methods['quail_api_method_immediate_database'] = array(
'human_name' => t("Immediately Validate & Save"),
'module' => 'quail_api',
'description' => t("Always perform the validation. Validation results are stored in the database."),
'database' => TRUE,
'automatic' => TRUE,
);
$validation_methods['quail_api_method_manual_database'] = array(
'human_name' => t("Manually Validate & Save"),
'module' => 'quail_api',
'description' => t("Perform the validation only when requested. Validation results are stored in the database."),
'database' => TRUE,
'automatic' => FALSE,
);
drupal_alter('quail_api_get_validation_methods', $validation_methods, $validation_method);
cache_set('quail_api_validation_methods', $validation_methods, 'cache');
if (!is_null($validation_method)) {
if (isset($validation_methods[$validation_method])) {
return $validation_methods[$validation_method];
}
return array();
}
return $validation_methods;
}