public static function WebformAccessibilityHelper::buildAriaHidden in Webform 8.5
Same name and namespace in other branches
- 6.x src/Utility/WebformAccessibilityHelper.php \Drupal\webform\Utility\WebformAccessibilityHelper::buildAriaHidden()
Aria hide text using aria-hidden attribute.
The aria-hidden property tells screen-readers if they should ignore the element.
Parameters
string|array $title: Text or #markup that should be aria-hidden.
Return value
array A renderable array with the text wrapped in <span aria-hidden="true">
See also
https://www.w3.org/TR/wai-aria-1.1/#aria-hidden
File
- src/
Utility/ WebformAccessibilityHelper.php, line 56
Class
- WebformAccessibilityHelper
- Helper class webform accessibility methods.
Namespace
Drupal\webform\UtilityCode
public static function buildAriaHidden($title) {
if (is_array($title)) {
return $title + [
'#prefix' => '<span aria-hidden="true">',
'#suffix' => '</span>',
];
}
else {
return [
'#markup' => $title,
'#prefix' => '<span aria-hidden="true">',
'#suffix' => '</span>',
];
}
}