You are here

function _clientside_validation_set_extensions in Clientside Validation 7

Same name and namespace in other branches
  1. 6 clientside_validation.module \_clientside_validation_set_extensions()

Set validation rule for file fields that must have a certain extension.

1 call to _clientside_validation_set_extensions()
clientside_validation_webform_after_build_recurse in clientside_validation_webform/clientside_validation_webform.module

File

./clientside_validation.module, line 1188
Add client side validation to forms.

Code

function _clientside_validation_set_extensions($name, $extensions, &$js_rules) {

  // @see https://drupal.org/comment/8428631#comment-8428631

  /*
  $extension_list = preg_replace('#,(?![^,]+,)#', ' or', implode(', ', $extensions));
  $js_rules[$name]['accept'] = implode('|', $extensions);
  $variables = array(
    'message' => "Only files with a %exts extension are allowed.",
    'placeholders' => array('%exts' => $extension_list),
    'error_type' => 'extensions',
    'element_name' => $name
  );
  $js_rules[$name]['messages']['accept'] = theme('clientside_error', $variables);
  */
}