在我的 hook_preprocess_node 函数中,我通过主题化和添加 at() 函数来更改链接以允许翻译。问题是当我在我的节点中渲染时,我打印出“ARRAY”这个词,这是使用
<?php print render($field_downloads); ?> or <?php print $field_downloads); ?>
在我的节点中。
template.php 中的代码
$list_of_paths = array();
foreach($field_downloads as $index => $data)
{
$file_uri = $data['uri'];
$file_path = file_create_url($file_uri);
$list_of_paths[] = '<strong> >>'. t('DOWNLOAD'). '</strong> '.l(t($data['description']), $file_path);
}
$variables['field_downloads'] .= theme("item_list", array(
'items' => $list_of_paths,
'type' => 'ul',
'attributes' => array('class' => 'downloads'),
));
}