You are here

function hook_quail_api_get_validation_methods in Quail API 8

Same name and namespace in other branches
  1. 7 quail_api.api.php \hook_quail_api_get_validation_methods()

Define quail api valodation methods.

This allows for custom modules to define their own quail api validation methods or alter an existing validation method.

Parameters

$validation_methods: An array of validation methods that is returned to the caller.

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.

$other_arguments: (optional) Array of additional arguments.

The validation_methods array has the following structure:

  • validation method: An array (whose key is the machine name of the validation method) defining a given validation method using the following keys:

    • machine name: Machine name of the standard.
    • human name: Human friendly name of the standard.
    • module: Machine name of the primary module providing this display level.
    • description: A description of the standard, wrapped in t().
    • id: Numerical id of the display level, this must match the array key.
    • default: A boolean representing whether or not to have this display level enabled by default.

See also

QuailApiSettings::get_validation_methods()

QuailApiSettings::get_validation_methods_list()

File

./quail_api.api.php, line 160
Hooks provided by the quail api.

Code

function hook_quail_api_get_validation_methods(&$validation_methods, $validation_method) {
  if (empty($validation_method) || $validation_methods == 'quail_api_method_stare') {
    $validation_methods['quail_api_method_stare'] = array(
      'human_name' => t("Immediately Stare"),
      'module' => 'quail_api',
      'description' => t("Make the validator stare at you when performing validation. Stare results are never saved."),
      'database' => FALSE,
      'automatic' => TRUE,
    );
  }
}