function _webform_csv_data_optionsmarkup in Webform Options Markup 7
Same name and namespace in other branches
- 7.2 components/webform_optionsmarkup.inc \_webform_csv_data_optionsmarkup()
Implements _webform_csv_data_component().
File
- components/
webform_optionsmarkup.inc, line 523 - Webform component that allows markup in checkbox and radio options.
Code
function _webform_csv_data_optionsmarkup($component, $export_options, $value) {
$options = _webform_optionsmarkup_options($component, TRUE, FALSE);
$return = array();
if ($component['extra']['multiple']) {
foreach ($options as $key => $item) {
$index = array_search($key, (array) $value);
if ($index !== FALSE) {
if ($export_options['select_format'] == 'separate') {
$return[] = 'X';
}
else {
$return[] = $export_options['select_keys'] ? $key : $item['title'];
}
unset($value[$index]);
}
elseif ($export_options['select_format'] == 'separate') {
$return[] = '';
}
}
}
else {
$key = $value[0];
if ($export_options['select_keys']) {
$return = $key;
}
else {
$return = isset($options[$key]['title']) ? $options[$key]['title'] : $key;
}
}
if ($component['extra']['multiple'] && $export_options['select_format'] == 'compact') {
$return = implode(',', (array) $return);
}
return $return;
}