You are here

function field_test_widget_multiple_validate in Drupal 7

Form element validation handler for 'test_field_widget_multiple' widget.

1 string reference to 'field_test_widget_multiple_validate'
field_test_field_widget_form in modules/field/tests/field_test.field.inc
Implements hook_field_widget_form().

File

modules/field/tests/field_test.field.inc, line 215
Defines a field type and its formatters and widgets.

Code

function field_test_widget_multiple_validate($element, &$form_state) {
  $values = array_map('trim', explode(',', $element['#value']));
  $items = array();
  foreach ($values as $value) {
    $items[] = array(
      'value' => $value,
    );
  }
  form_set_value($element, $items, $form_state);
}