While trying to do some css overriding of poll module block links ("Older polls", specifically), I stumbled across what seems to be a minor bug.

Poll.module, rather than employing the usual hook_link(), adds its links in poll_view(). (See http://api.drupal.org/api/function/poll_view/6)

The relevant lines are:

    $links = module_invoke_all('link', 'node', $node, 1);
    $links[] = array('title' => t('Older polls'), 'href' => 'poll', 'attributes' => array('title' => t('View the list of polls on this site.')));
    if ($node->allowvotes && $block) {
      $links[] = array('title' => t('Results'), 'href' => 'node/'. $node->nid .'/results', 'attributes' => array('title' => t('View the current poll results.')));
    }

Shouldn't the $links[] additions include a key? I.e. - $links['poll_older_polls'] and $links['poll_results']?

Since keys aren't added, when hook_link builds the actual links, the poll links lack any kind of css class. For example, at one site I'm working on:

<li class="0 first last"><a href="/poll" title="View the list of polls on this site.">Older polls</a></li>
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

chromeyellow’s picture

Slight elaboration: I shouldn't have said "the poll links lack any kind of css class"; rather they lack useful classes. "first" and "last" are fluid of course, depending on what other links may be present ("view results", various comment links, etc).

chromeyellow’s picture

Status: Active » Needs review
FileSize
989 bytes

Patch.

chromeyellow’s picture

FileSize
989 bytes

Apologies, previous patch suffers some backwardation...

chromeyellow’s picture

FileSize
944 bytes

One more try...

Status: Needs review » Needs work

The last submitted patch, poll_link_array_key.patch, failed testing.

chromeyellow’s picture

Status: Needs work » Needs review
FileSize
944 bytes

Granted I am behind the times on automated testing... the code in this patch is guaranteed to fix this issue.

If the attached, test-evading patch fails for any reason, feel free, Next Person, to roll it into your own patch and take the kudos for this fix.

ndstate’s picture

What could be the repercussions of not applying this patch? Could this relate at all to my issue of the poll vote button taking on random links and not working?

Thanks

Emmanuel.masanche’s picture

#2: poll_link.patch queued for re-testing.

walker2238’s picture

+1 for this.

Status: Needs review » Closed (outdated)

Automatically closed because Drupal 6 is no longer supported. If the issue verifiably applies to later versions, please reopen with details and update the version.