function linkicon_extract_allowed_values in Link Icon 7
Extracts link title textarea values into array for link title select options.
2 calls to linkicon_extract_allowed_values()
- linkicon_field_formatter_prepare_view in ./
linkicon.module - Implements hook_field_formatter_prepare_view().
- linkicon_field_process in ./
linkicon.module - Overrides link_field_process() to use a select box.
File
- ./
linkicon.module, line 181 - A link field formatter to create icon classes based on predefined titles.
Code
function linkicon_extract_allowed_values($values, $is_tooltip = FALSE) {
$allowed_values = array();
if ($values) {
$list = explode("\n", strip_tags($values));
foreach ($list as $value) {
if (strpos($value, "|") !== FALSE) {
list($key, $title, $tooltip) = array_pad(array_map('trim', explode("|", $value, 3)), 3, NULL);
$allowed_values[$key] = $is_tooltip && !empty($tooltip) ? $tooltip : $title;
}
else {
$allowed_values[$value] = $value;
}
}
}
return $allowed_values;
}