You are here

function content_taxonomy_tree_form2data in Content Taxonomy 6

Same name and namespace in other branches
  1. 6.2 content_taxonomy_tree.module \content_taxonomy_tree_form2data()

Helper function to transpose the values returned by submitting the content_taxonomy_tree to the format to be stored in the field

1 call to content_taxonomy_tree_form2data()
content_taxonomy_tree_validate in ./content_taxonomy_tree.module
Validation function for the content_taxonomy_tree element

File

./content_taxonomy_tree.module, line 181

Code

function content_taxonomy_tree_form2data($element, &$form_state, $field) {
  $field_key = $element['#columns'][0];
  $selected_terms = $form_state['values'][$element['#field_name']][$field_key]['selected_terms'];
  if (!is_array($selected_terms) || !count($selected_terms)) {
    $selected_terms[] = NULL;
  }
  $form_state['#field_info'][$field['field_name']] = $field;
  return content_transpose_array_rows_cols(array(
    $element['#columns'][0] => array_values($selected_terms),
  ));
}