php - if ($node->type == 'x') not working in theme_upload_attachments function -


i want header uploaded files display different text depending on node type. overrided core function copying theme's template.php file , renamed phptemplate_upload_attachments.

<?php     function phptemplate_upload_attachments($files) {         global $node;         $header = array(t('default text'), t('size'));          if ($node->type == 'orange') {             $header = array(t('orange custom text'), t('size'));         }           $rows = array();         foreach($files $file) {             $file = (object)$file;             if ($file->list && empty($file->remove)) {                 $href = file_create_url($file->filepath);                 $text = $file->description ? $file->description : $file->filename;                 $rows[] = array(l($text, $href), format_size($file->filesize));             }         }         if (count($rows)) {             return theme('table', $header, $rows, array('id' => 'attachments'));         }     } ?> 

as can guess, added line orange node type, not work. know function correctly overidden because tested changing default text. also, cleared cache, , tried adding global $node.

why not working?

is $node available? try this:

$node = node_load(arg(1)); 

Comments

Popular posts from this blog

linux - Mailx and Gmail nss config dir -

c# - Is it possible to remove an existing registration from Autofac container builder? -

php - Mysql PK and FK char(36) vs int(10) -