Patch that makes sure that the description HTML is only shown if a description is actually set for the vocabulary term.

CommentFileSizeAuthor
#4 taxonomy-pages-hide-description-when-empty-v3.patch984 bytesAnonymous (not verified)
#2 taxonomy-pages-hide-description-when-empty-v2.patch1002 bytesAnonymous (not verified)
taxonomy-pages-hide-description-when-empty.patch389 bytesAnonymous (not verified)

Comments

webchick’s picture

Status: Needs review » Needs work

Yep, I can confirm this bug, and that the patch fixes it.

I'm going to be a stickler here though, since that is the Drupal way, and this way you learn good practices, since I know you're new to core patching. :)

a) When you roll patches, please do so from the Drupal root directory (the one with INSTALL.txt, etc. in it). That makes it easier for people to apply them.
b) Please use cvs diff -up > blah.patch to roll your patches. The -up provides much more human-readable output, and also indicates which function is being affected.
c)

+ // Also check that a description is present

You're missing a space before this line, so that it lines up with the one below (told you I was going to be a stickler ;))
d) About this code:

if (count(($tids) == 1) && (!empty(taxonomy_get_term($tids[0])->description))) {

- That's an awful lot of stuff to do on one line. :)
- You're doing a taxonomy_get_term here, then throwing away the result, then immediately on the next line doing one again. While the terms are cached, if you already have the value once, why not re-use it? I'd maybe move the !empty check around the $output variable instead.

Anonymous’s picture

Status: Needs work » Needs review
StatusFileSize
new1002 bytes

Improved version of above patch, taking into account webchick's comments.

webchick’s picture

Status: Needs review » Needs work

Cool! This is just about there, but remember to adhere to our Coding Standards. Specifically:

  1. The whole part from "check that a description is set" to the closing } on the if is indented two too many spaces. Indents are 2 spaces, no tabs.
  2. The comment should be "Check that a description is set." (capitalized, and with a period at the end)
  3. There should be a space between the if and the (
  4. The { after the if needs to go on the same line

Incidentally, there's this rad module called Coder that can do these sort of coding standards checks for you automatically. Nice to run just before you upload a patch to make sure you didn't miss anything. :)

Anonymous’s picture

Status: Needs work » Needs review
StatusFileSize
new984 bytes

Changes to adhere to Coding Standards.

webchick’s picture

Title: taxonomy.pages.inc displays html for description, even when no description is set for vocabulary term » term description HTML always shown whether description exists or not

Tested, working, can't find anything else wrong. :) Marking RTBC.

webchick’s picture

Status: Needs review » Reviewed & tested by the community

Ahem.

gábor hojtsy’s picture

Status: Reviewed & tested by the community » Fixed

Looks good and logical, thanks, committed.

Anonymous’s picture

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for two weeks with no activity.