function IconExtractorSettingsForm::getOptions
Get option list for enumerations.
Parameters
array $setting: The settings from the icon pack definition.
Return value
array The enum options for select.
1 call to IconExtractorSettingsForm::getOptions()
- IconExtractorSettingsForm::buildEnumForm in core/
lib/ Drupal/ Core/ Theme/ Icon/ IconExtractorSettingsForm.php - Build Drupal form for an enumerations to a select.
File
-
core/
lib/ Drupal/ Core/ Theme/ Icon/ IconExtractorSettingsForm.php, line 146
Class
- IconExtractorSettingsForm
- Handle icon extractor settings form conversion from YAML to Drupal Form API.
Namespace
Drupal\Core\Theme\IconCode
protected static function getOptions(array $setting) : array {
$options = array_combine($setting['enum'], $setting['enum']);
foreach ($options as $key => $label) {
if (is_string($label)) {
$options[$key] = Unicode::ucwords($label);
}
}
// Key meta:enum is used to provide a description for the enum list.
// There is currently no official JSON Schema specification for enum
// description, meta:enum is adopted by Adobe in
// https://github.com/adobe/jsonschema2md and Coveo Open-Source in
// https://github.com/coveooss/json-schema-for-humans.
if (!isset($setting['meta:enum'])) {
return $options;
}
$meta = $setting['meta:enum'];
// Remove meta:enum items not found in options.
return array_intersect_key($meta, $options);
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.