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.
Not a bug as such...As pollfield works with views, it may arise that more than one poll is visible at any given time (eg within a node and within a block). With this in mind, I would suggest replacing
$poll_result="
";
with
$poll_result="
";
Just to stop validator grumbling. I also noticed that views is wrapping a
print $field->element_type;
WITH
// Set the fields in this view to be treated as blocks
$my_element_type = 'div';
print $my_element_type;
Cheers :)
Comments
Comment #1
Wayne Ashley CreditAttribution: Wayne Ashley commentedOops, the comment block doesn't like me writing code. Basically, replace the id definition for pollfield with a class definition.
As for the other error. Views is wrapping a span around the pollfield causeing validator to gripe. field->element_type needs to be set to DIV; as I don't know how to go about this myself, I just stuck a temporary fix together myself by copying views-view-fields.tpl.php from modules/views/theme to my site theme, and renamed it views-view-fields--poll*.tpl.php *whatever your view is called, and replaced
print $field->element_type;
WITH
$my_element_type = 'div';
print $my_element_type;
Comment #2
nibblebot CreditAttribution: nibblebot commentedsubscribe
Comment #3
bryan kennedy CreditAttribution: bryan kennedy commentedAhh yes, good find. This is still an active bug.
There are many situations where a pollfield can appear more than once on a page. I want to make this change for the next release, but need to document the upgrade path. Should be simple for users to fix, but with this change to the module css, people's css is likely to change. I'll work on the changes this weekend. Elevating status since breaking HTML validation is double plus bad.