You are here

public static function QuailApiSettings::get_standards_list in Quail API 8

Returns a list of standards.

This is only a list of the machine_name and human_name of the select lists. Use this for populating select lists, radio buttons, and check boxes.

Parameters

array|null $standards: Providing a valid array of standards as returned by QuailApiSettings::get_standards() and it will be properly converted into a standards list.

string $target: (optional) 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'.

Return value

array An array of standards that are supported by this module or extending modules. The array keys are the standard machine name and the array value is the human name.

See also

QuailApiSettings::get_standards()

File

src/QuailApiSettings.php, line 195

Class

QuailApiSettings
Class QuailApiSettings.

Namespace

Drupal\quail_api

Code

public static function get_standards_list($standards = NULL, $target = 'snippet') {
  if (is_null($standards)) {
    $standards = static::get_standards(NULL, $target);
  }
  $standards_list = [];
  foreach ($standards as $machine_name => $value) {
    if (!isset($value['target']) || $value['target'] != $target) {
      continue;
    }
    if (isset($value['human_name'])) {
      $standards_list[$machine_name] = $value['human_name'];
    }
  }
  return $standards_list;
}