function _fillpdf_process_destination_path in FillPDF 7.2
Same name and namespace in other branches
- 6 fillpdf.module \_fillpdf_process_destination_path()
- 7 fillpdf.module \_fillpdf_process_destination_path()
1 call to _fillpdf_process_destination_path()
File
- ./
fillpdf.module, line 1014 - Allows mappings of PDFs to site content
Code
function _fillpdf_process_destination_path($destination_path, $token_objects) {
// Two formats of $destination_path are possible:
// 1) /absolute/path/to/directory
// 2) path/below/files/directory
// So, first: Does it begin with a forward slash?
$orig_path = $destination_path;
$destination_path = trim($orig_path);
// Replace any applicable tokens
$types = array();
if (isset($token_objects['node'])) {
$types[] = 'node';
}
elseif (isset($token_objects['webform'])) {
$types[] = 'webform';
}
foreach ($types as $type) {
$destination_path = token_replace($destination_path, array(
$type => $token_objects[$type],
), array(
'clear' => TRUE,
));
}
if (drupal_substr($destination_path, 0, 1) === '/') {
// No further modifications needed
}
else {
// Slap on the files directory in front and return it
$destination_path = file_build_uri($destination_path);
}
return $destination_path;
}