You are here

function _filefield_widget_settings_extensions_validate in FileField 6.3

A FAPI #element_validate callback to strip commas from extension lists.

1 string reference to '_filefield_widget_settings_extensions_validate'
filefield_widget_settings_form in ./filefield_widget.inc
Implementation of CCK's hook_widget_settings($op == 'form').

File

./filefield_widget.inc, line 108
This file contains CCK widget related functionality.

Code

function _filefield_widget_settings_extensions_validate($element, &$form_state) {

  // Remove commas and leading dots from file extensions.
  $value = str_replace(',', ' ', $element['#value']);
  $value = str_replace(' .', ' ', $value);
  $value = array_filter(explode(' ', $value));
  $value = implode(' ', $value);
  form_set_value($element, $value, $form_state);
}