You are here

function synonyms_select_form_to_storage in Synonyms 7

Convert synonyms friendly select widget values for storage friendly format.

It acts similar to what the _options_form_to_storage() function does - bridges between how values are returned from form API to how they are expected by Field module.

2 string references to 'synonyms_select_form_to_storage'
synonyms_commerce_field_widget_form in synonyms_commerce/synonyms_commerce.module
Implements hook_field_widget_form().
synonyms_field_widget_form in ./synonyms.module
Implements hook_field_widget_form().

File

./synonyms.module, line 1189
Provide synonyms feature for Drupal entities.

Code

function synonyms_select_form_to_storage($element, &$form_state) {
  $form_state_value = array();
  foreach (drupal_array_get_nested_value($form_state['values'], $element['#parents']) as $entity_id) {
    $form_state_value[] = array(
      $element['#columns'][0] => $entity_id,
    );
  }
  form_set_value($element, $form_state_value, $form_state);
}