optionwidgets_form2data($element, $field)
contributions/cck/modules/optionwidgets/optionwidgets.module, line 349
Helper function to transpose the values returned by submitting the widget to the format to be stored in the field. Can be called anywhere this transformation is needed.
<?php
function optionwidgets_form2data($element, $field) {
$field_key = $element['#columns'][0];
$items = (array) $element[$field_key]['#value'];
$options = optionwidgets_options($field);
$values = array_values($items);
if ($element['#type'] == 'optionwidgets_onoff' && ($values[0] === 0)) {
$keys = array_keys($options);
$values = array(array_key_exists(0, $keys) ? $keys[0] : NULL);
}
if (empty($values)) {
$values[] = NULL;
}
$result = content_transpose_array_rows_cols(array($field_key => $values));
return $result;
}
?>