The display of a wishlist node can be overridden by a file called node--wishlist.tpl.php in the templates folder of the theme. The display of the wishlist content within the node is normally provided by the template wishlist-content--node.tpl.php.
This patch makes it simpler to change the display by passing the wishlist variables to the node so they can be used in the new template. This is done using hook_preprocess_node.
As an example, put the following code in node--wishlist.tpl.php to replicate the output of wishlist-content--node.tpl.php.
<div id="node-<?php print $node->nid; ?>" class="<?php print $classes; ?> clearfix"<?php print $attributes; ?>>
<?php print render($title_prefix); ?>
<?php if (!$page): ?>
<h2<?php print $title_attributes; ?>>
<a href="<?php print $node_url; ?>"><?php print $title; ?></a>
</h2>
<?php endif; ?>
<?php print render($title_suffix); ?>
<?php if ($display_submitted): ?>
<div class="meta submitted">
<?php print $user_picture; ?>
<?php print $submitted; ?>
</div>
<?php endif; ?>
<div class="content clearfix"<?php print $content_attributes; ?>>
<?php print render($content['body']);?>
<div class='wishlist'>
<div class='wl_spacer'> </div>
<div class='main-body'>
<?php
print $wishlist_cost;
print $wishlist_url1;
print $wishlist_url2;
print $wishlist_purchased_items_table;
print $wishlist_last_updated;
?>
</div>
<div class='purchase-info'>
<?php
print $wishlist_reveal_form;
print $wishlist_priority;
print $wishlist_requested;
print $wishlist_purchased;
print $wishlist_items_user_purchased;
?>
</div>
<div class='wl_spacer'> </div>
</div>
</div>
<?php // Only display the wrapper div if there are links.
$links = render($content['links']);
if ($links):
?>
<div class="link-wrapper">
<?php print $links; ?>
</div>
<?php
endif;
?>
<?php print render($content['comments']); ?>
</div>
| Comment | File | Size | Author |
|---|---|---|---|
| #2 | wishlist-preprocess_node-1347762-2.patch | 2.08 KB | polynya |
| #1 | wishlist-preprocess_node-1347762.patch | 2.11 KB | polynya |
Comments
Comment #1
polynya commentedComment #2
polynya commentedPlease use this patch instead.
Comment #3
scott.mclewin commentedCommitted to master and 7.x-2.x dev branches
Comment #3.0
scott.mclewin commentedImproving the description of the patch.