function _options_prepare_options in Drupal 7
Sanitizes the options.
The function is recursive to support optgroups.
1 call to _options_prepare_options()
- _options_get_options in modules/
field/ modules/ options/ options.module - Collects the options for a field.
File
- modules/
field/ modules/ options/ options.module, line 268 - Defines selection, check box and radio button widgets for text and numeric fields.
Code
function _options_prepare_options(&$options, $properties) {
foreach ($options as $value => $label) {
// Recurse for optgroups.
if (is_array($label)) {
_options_prepare_options($options[$value], $properties);
}
else {
// The 'strip_tags' option is deprecated. Use 'strip_tags_and_unescape'
// when plain text is required (and where the output will be run through
// check_plain() before being inserted back into HTML) or 'filter_xss'
// when HTML is required.
if ($properties['strip_tags']) {
$options[$value] = strip_tags($label);
}
if ($properties['strip_tags_and_unescape']) {
$options[$value] = decode_entities(strip_tags($label));
}
if ($properties['filter_xss']) {
$options[$value] = field_filter_xss($label);
}
}
}
}