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'>&nbsp;</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'>&nbsp;</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>

Comments

polynya’s picture

StatusFileSize
new2.11 KB
polynya’s picture

StatusFileSize
new2.08 KB

Please use this patch instead.

scott.mclewin’s picture

Status: Needs review » Closed (fixed)

Committed to master and 7.x-2.x dev branches

scott.mclewin’s picture

Issue summary: View changes

Improving the description of the patch.