Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
I recently updated from 3.0 to 3.7. Lately I noticed that the links wrapper was being printed in nodes even if there were no links or tags. I'm referring to the following code.
<?php if (!empty($content['field_tags']) || !empty($content['links'])): ?>
<footer>
<?php print render($content['field_tags']); ?>
<?php print render($content['links']); ?>
</footer>
<?php endif; ?>
I will submit a patch that fixes this issue.
Comment | File | Size | Author |
---|---|---|---|
#6 | 707484-3-fix-condition-for-printing-links-wrapper.patch | 811 bytes | bisonbleu |
Comments
Comment #2
bisonbleu CreditAttribution: bisonbleu commentedHere is the patch. In it, I'm replacing the if statement with this one adapted from Bartik.
Comment #3
markhalliwellNo need to pass it through
render()
again below, just print the newly created rendered variables.Comment #4
bisonbleu CreditAttribution: bisonbleu commentedRight. Here's a new patch as per recommendation in #3.
Comment #5
markhalliwellNo... use the
$links
and$field_tags
variables this patch creates.Comment #6
bisonbleu CreditAttribution: bisonbleu commentedI think there should be an issue queue award for "Sleeping on the switch" because this one would make me a very serious contender!
Thanks for your patience @markcarver.
Comment #8
markhalliwellNp :D ty!