function pathauto_filefield_paths_field_postprocess in File (Field) Paths 6.2
Implements hook_filefield_paths_field_postprocess().
File
- modules/
pathauto.inc, line 19 - Pathauto module integration.
Code
function pathauto_filefield_paths_field_postprocess($value, $field, $settings) {
if ($settings['pathauto']) {
module_load_include('inc', 'pathauto');
if ($field == 'file_name') {
$pathinfo = pathinfo($value);
$value = drupal_substr($value, 0, drupal_strlen($value) - drupal_strlen($pathinfo['extension']) - 1);
}
$values = explode('/', $value);
foreach ($values as &$tmp_value) {
$tmp_value = pathauto_cleanstring($tmp_value);
}
$value = implode('/', $values);
if ($field == 'file_name') {
$value .= '.' . pathauto_cleanstring($pathinfo['extension']);
}
}
}