Last active
December 20, 2015 18:28
-
-
Save soulston/6175686 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Override or insert variables into the node template. | |
*/ | |
function MYTHEME_preprocess_node(&$variables) { | |
if ($variables['node']->type == 'article') { | |
kpr($variables['node']); | |
$node = $variables['node']; | |
if (isset($variables['node']->field_file)) { | |
$file = field_get_items('node', $node, 'field_file'); | |
$file = reset($file); | |
kpr($file); | |
$file = file_load($file['fid']); | |
$file_uri = drupal_realpath($file->uri); | |
kpr($file_uri); | |
$variables['download_link'] = l('Download', $file_uri); | |
kpr($variables['download_link']); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Remove the kpr's and change:
"article" to "developments"
"field_file" to "field_development_brochure"
print render the newly created $download_link variable