You are here

function _upload_element_allowed_extensions in Upload element 6

Private helper function to help pull out the allowed extensions.

Parameters

array $element:

1 call to _upload_element_allowed_extensions()
theme_upload_element_file_description in ./upload_element.module
This theming function can be used to assign different text to the description that is found under the file HTML element.

File

./upload_element.module, line 642
A module that provides two new elements to the FAPI for file handling.

Code

function _upload_element_allowed_extensions($element) {
  if ($element['#type'] == 'upload_element') {
    return array_filter(explode(' ', strtoupper($element['#file_validators']['file_validate_extensions'][0])));
  }
  elseif (isset($element['#file_validators']['file_validate_extensions'])) {
    return array_intersect(explode(' ', strtoupper($element['#file_validators']['file_validate_extensions'][0])), array(
      'JPEG',
      'GIF',
      'PNG',
    ));
  }
  else {
    return array(
      'JPEG',
      'GIF',
      'PNG',
    );
  }
}