function FilterHtml::findAllowedValue
Same name in other branches
- 8.9.x core/modules/filter/src/Plugin/Filter/FilterHtml.php \Drupal\filter\Plugin\Filter\FilterHtml::findAllowedValue()
- 10 core/modules/filter/src/Plugin/Filter/FilterHtml.php \Drupal\filter\Plugin\Filter\FilterHtml::findAllowedValue()
- 11.x core/modules/filter/src/Plugin/Filter/FilterHtml.php \Drupal\filter\Plugin\Filter\FilterHtml::findAllowedValue()
Helper function to handle prefix matching.
Parameters
array $allowed: Array of allowed names and prefixes.
string $name: The name to find or match against a prefix.
Return value
bool|array
1 call to FilterHtml::findAllowedValue()
- FilterHtml::filterElementAttributes in core/
modules/ filter/ src/ Plugin/ Filter/ FilterHtml.php - Filters attributes on an element according to a list of allowed values.
File
-
core/
modules/ filter/ src/ Plugin/ Filter/ FilterHtml.php, line 200
Class
- FilterHtml
- Provides a filter to limit allowed HTML tags.
Namespace
Drupal\filter\Plugin\FilterCode
protected function findAllowedValue(array $allowed, $name) {
if (isset($allowed['exact'][$name])) {
return $allowed['exact'][$name];
}
// Handle prefix (wildcard) matches.
foreach ($allowed['prefix'] as $prefix => $value) {
if (strpos($name, $prefix) === 0) {
return $value;
}
}
return FALSE;
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.