You are here

function imagecache_element_presetname_validate in ImageCache 5.2

File

./imagecache_ui.module, line 150

Code

function imagecache_element_presetname_validate($element) {

  // Check for duplicates
  $presets = imagecache_presets();
  if (in_array($element['#value'], $presets)) {
    form_set_error($element['#name'], t('The namespace you have chosen is already in use.'));
  }

  // Check for illegal characters in preset names
  if (preg_match('/[^0-9a-zA-Z_\\-]/', $element['#value'])) {
    form_set_error($element['#name'], t('Please only use alphanumeric characters, underscores (_), and hyphens (-) for preset names.'));
  }
}