function hs_taxonomy_widget_process in Hierarchical Select 7.3
#process callback that runs after HS' #process callback, to transform #return_value to the format that Field API/Taxonomy Field expects.
1 string reference to 'hs_taxonomy_widget_process'
- hs_taxonomy_field_widget_form in modules/
hs_taxonomy.module - Implements hook_field_widget_form().
File
- modules/
hs_taxonomy.module, line 333 - Implementation of the Hierarchical Select API for the Taxonomy module.
Code
function hs_taxonomy_widget_process($element, &$form_state, $complete_form) {
$tids = $element['#return_value'];
// If #return_value is array(NULL), then nothing was selected!
if (count($tids) == 1 && $tids[0] === NULL) {
$element['#return_value'] = array();
return $element;
}
$items = array();
foreach ($tids as $tid) {
$items[] = array(
'tid' => $tid,
);
}
$element['#return_value'] = $items;
return $element;
}