You are here

function ctools_filefield_paths_field_postprocess in File (Field) Paths 6.2

Implements hook_filefield_paths_field_postprocess().

File

modules/ctools.inc, line 19
CTools module integration.

Code

function ctools_filefield_paths_field_postprocess($value, $field, $settings) {
  if ($settings['ctools']) {
    ctools_include('cleanstring');
    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 = ctools_cleanstring($tmp_value);
    }
    $value = implode('/', $values);
    if ($field == 'file_name') {
      $value .= '.' . ctools_cleanstring($pathinfo['extension']);
    }
  }
}