? .svn ? fivestar-translation.diff ? css/.svn ? images/.svn ? js/.svn ? translations/.svn ? widgets/.svn ? widgets/basic/.svn ? widgets/craft/.svn ? widgets/default/.svn ? widgets/flames/.svn ? widgets/hearts/.svn ? widgets/minimal/.svn ? widgets/outline/.svn ? widgets/oxygen/.svn ? widgets/small/.svn Index: fivestar.module =================================================================== RCS file: /cvs/drupal-contrib/contributions/modules/fivestar/fivestar.module,v retrieving revision 1.13.2.38 diff -u -p -r1.13.2.38 fivestar.module --- fivestar.module 23 Aug 2008 05:17:09 -0000 1.13.2.38 +++ fivestar.module 11 Sep 2008 21:45:41 -0000 @@ -137,12 +137,21 @@ function fivestar_theme() { } /** + * Implementation of hook_form_alter(). + * + * Adds translation setting selection to the Voting API configuration form. + */ +function fivestar_form_votingapi_settings_form_alter(&$form, &$form_state) { + votingapi_settings_form_translation($form); +} + +/** * Implementation of hook_form_alter * Adds fivestar enaable and position to the node-type configuration form. * */ -function fivestar_form_alter(&$form, &$form_state, $form_id) { - if ($form_id == 'node_type_form' && isset($form['identity']['type'])) { +function fivestar_form_node_type_form_alter(&$form, &$form_state) { + if (isset($form['identity']['type'])) { // Goofy hack to get the buttons at the end of the array. $form['workflow']['#weight'] = isset($form['workflow']['#weight']) ? $form['workflow']['#weight'] + 1 : 1; $form['submit']['#weight'] = isset($form['submit']['#weight']) ? $form['submit']['#weight'] + 1 : 1; @@ -936,8 +945,16 @@ function fivestar_block($op = 'list', $d } } +/** + * Get the fivestar widget form for a node. + * + * If Voting API is set to register votes to the source translation, {node}.tnid + * is substituted here for {node}.nid, meaning that all votes are assigned to and + * read from the source translation of a translation set. + */ function fivestar_widget_form($node) { - return drupal_get_form('fivestar_form_node_'. $node->nid, 'node', $node->nid); + $id = $node->tnid && variable_get('votingapi_translation', 'default') == 'source' ? $node->tnid : $node->nid; + return drupal_get_form('fivestar_form_node_'. $id, 'node', $id); } /**