Ability to set more variables

kastaway - August 4, 2005 - 20:59
Project:Voting
Version:HEAD
Component:User interface
Category:feature request
Priority:normal
Assigned:Unassigned
Status:closed
Description

I wanted to be able to set the background color of the embedded voting blocks to match the background color of whatever page I'm using. So in other words, to set 'bgcolor' as flexibly as changing the 'prompt' and 'confirmation' text.

So I just added the following line to 'voting.module':

function theme_voting_control_flash($content_type, $content_id, $attributes = array()) {
[snip]
  // optional variables
[snip]
  $txt_after_vote = urlencode(($attributes['confirmation']) ? $attributes['confirmation'] : variable_get('voting_txt_after_vote', 'My Vote:'));
// START ADDED -- 03AUG2005
  $bgcolor = urlencode(($attributes['bgcolor']) ? $attributes['bgcolor'] : variable_get('voting_bgcolor', '0xffffff'));
// END ADDED -- 03AUG2005

Now, in my own pages, when I add the $output line, I can use a third variable for 'bgcolor' immediately after 'prompt' and 'confirmation', like:

$output .= voting_control_generic('pagevote', $node->nid, array('prompt' => 'Do you like it?', 'confirmation' => 'Vote saved!', 'bgcolor' => '0xffffff'));

#1

benshell - September 9, 2005 - 19:07
Status:active» closed

Thanks, I added this to the CVS and 4.6 versions today.

 
 

Drupal is a registered trademark of Dries Buytaert.