You are here

function hook_quail_api_get_standards_alter in Quail API 7

Same name and namespace in other branches
  1. 8 quail_api.api.php \hook_quail_api_get_standards_alter()

Define quail api standards.

This allows for custom modules to define their own quail api standards or variations of a given standard.

Parameters

$standards: An array of standards that is returned to the caller.

$standard: (optional) A machine name string of the standard to use. When defined, only the standard that matches this string will loaded into the standards array. When undefined, all standards will be loaded into the standards array.

$other_arguments: (optional) Array of additional arguments.

The standards array has the following structure:

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

    • human_name: Human friendly name of the standard.
    • module: Machine name of the primary module providing this standard.
    • description: A description of the standard, wrapped in t().
    • guideline: Machine name of the guideline. This is used to load the guideline class whose class object must be defined as follows:

      • ${guideline}_${standard}Guideline extends quailGuideline { ...

      If the standard were called 'wcag7_4d' and the guideline were called 'hypercube', then the class object would be:

      • wcag7_4d_hypercubeGuideline extends quailGuideline { ...
    • reporter: Machine name of the reporter. This is used to load the reporter class whose class object must be defined as follows:

      • report${reporter} extends quailReporter { ...

      If the guideline were called 'hypercube', then the class object would be:

      • reportHypercube extends quailReporter { ...
      • Take special note of the upper-case H, the quail library requires that the first character of the guideline name be uppercase.
    • target: Target allows for selecting standards based on some category or purpose.

      • The target, in general, represents the scope in which the standards will be applied.
      • The following targets are directly supported: 'snippet', 'page'.

The other_arguments array has the following structure:

  • target: A machine name string of a target to use. Providing a target allows for limiting standards by some category. The target, in general, represents the scope in which the standards will be applied. The following targets are directly supported: 'snippet', 'page'.

See also

quail_api_get_standards()

quail_api_get_standards_list()

1 invocation of hook_quail_api_get_standards_alter()
quail_api_get_standards in ./quail_api.module
Returns an array of standards that are supported.

File

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

Code

function hook_quail_api_get_standards_alter(&$standards, $standard, $other_arguments) {
  if ($other_arguments['target'] == 'tesseract' || $standard == 'wcag7_4d') {
    $standards['wcag7_4d'] = array(
      'human_name' => t("WCAG 7.0 - 4D"),
      'module' => 'wcag7',
      'description' => t("Validate using WCAG 7.0. This provides 4th dimensional content in such a way that users who can only perceive 3 dimensions may appropriately navigate and understand said content."),
      'guideline' => 'hypercube',
      'reporter' => 'hypercube',
      'target' => $other_arguments['target'],
    );
  }
}