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.
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>
Comment | File | Size | Author |
---|---|---|---|
#6 | poll_link_array_key-D6.patch | 944 bytes | chromeyellow |
#4 | poll_link_array_key.patch | 944 bytes | chromeyellow |
#3 | poll_link.patch | 989 bytes | chromeyellow |
#2 | poll_link.patch | 989 bytes | chromeyellow |
Comments
Comment #1
chromeyellow CreditAttribution: chromeyellow commentedSlight 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).
Comment #2
chromeyellow CreditAttribution: chromeyellow commentedPatch.
Comment #3
chromeyellow CreditAttribution: chromeyellow commentedApologies, previous patch suffers some backwardation...
Comment #4
chromeyellow CreditAttribution: chromeyellow commentedOne more try...
Comment #6
chromeyellow CreditAttribution: chromeyellow commentedGranted 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.
Comment #7
ndstate CreditAttribution: ndstate commentedWhat 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
Comment #8
Emmanuel.masanche CreditAttribution: Emmanuel.masanche commented#2: poll_link.patch queued for re-testing.
Comment #9
walker2238 CreditAttribution: walker2238 commented+1 for this.