function filefield_paths_process_string in File (Field) Paths 5
Same name and namespace in other branches
- 8 filefield_paths.module \filefield_paths_process_string()
- 6 filefield_paths.module \filefield_paths_process_string()
- 7 filefield_paths.module \filefield_paths_process_string()
Process and cleanup strings.
1 call to filefield_paths_process_string()
- filefield_paths_filefield_paths_process_file in ./
filefield_paths.module - Implementation of hook_filefield_paths_process_file().
File
- ./
filefield_paths.module, line 532 - Adds extra functionality to FileFields Path settings.
Code
function filefield_paths_process_string($value, $type, $object, $settings = array()) {
// Process string tokens.
$placeholders = _filefield_paths_get_values($type, $object, module_exists('pathauto') && isset($settings['pathauto']) && $settings['pathauto']);
$value = str_replace($placeholders['tokens'], $placeholders['values'], $value);
// Transliterate string.
if (module_exists('transliteration') && isset($settings['transliterate']) && $settings['transliterate']) {
$value = transliteration_get($value);
if ($type == 'field') {
$paths = explode('/', $value);
foreach ($paths as &$path) {
$path = transliteration_clean_filename($path);
}
$value = implode('/', $paths);
}
}
// Convert string to lower case.
if (isset($settings['tolower']) && $settings['tolower'] || isset($settings['pathauto']) && $settings['pathauto'] && variable_get('pathauto_case', 0)) {
// Convert string to lower case
$value = drupal_strtolower($value);
}
return $value;
}