Download & Extend

Make vud_node widget type alterable through code

Project:Vote Up/Down
Version:6.x-3.x-dev
Component:vud_node
Category:feature request
Priority:normal
Assigned:Unassigned
Status:closed (fixed)

Issue Summary

I'd like to add a simple drupal_alter() so that we can alter the widget type based on information in the node object.

I see this as a reasonable stopgap for the Drupal 6.x-3.x branch since #793048: Per content configuration is postponed.

My motivation is to have a single site using Vote Up/down with 2 different widgets depending on the node type.

AttachmentSizeStatusTest resultOperations
vote_up_down_node_widget_alter.patch1.18 KBIdlePASSED: [[SimpleTest]]: [MySQL] 129 pass(es).View details

Comments

#1

Status:needs review» needs work

Sounds pretty reasonable.

+++ b/vud.api.php
@@ -70,3 +70,16 @@ function hook_vud_votes(&$votes) {
+function hook_vud_node_widget_alter(&$widget, $node) {

Please move the this documentation to vud_node/vud_node.api.php and I could push your patch.

#2

Actually there are some other places where we should add the alter too:

$ git grep -n "variable_get('vud_node_widget'"
vud_node/views/vud_node_handler_field_widget.inc:42:        $widget_type = variable_get('vud_node_widget', 'plain');
vud_node/vud_node.module:88:    '#default_value' => variable_get('vud_node_widget', 'updown'),
vud_node/vud_node.module:149:        $widget = variable_get('vud_node_widget', 'plain');
vud_node/vud_node.module:256:      $widget_theme = variable_get('vud_node_widget', 'plain');

#3

Status:needs work» needs review

Thanks for the fast review!

Here's a re-roll with slightly updated documentation.

I left out altering vud_node/vud_node.module:88:    '#default_value' => variable_get('vud_node_widget', 'updown'), since that's where we set the default and the purpose of the new hook is to alter the default on a per-node basis.

Thanks!

AttachmentSizeStatusTest resultOperations
1398942-vote_up_down_node_widget_alter.patch2.52 KBIdlePASSED: [[SimpleTest]]: [MySQL] 129 pass(es).View details

#4

Title:Make widget type alterable through code» Make vud_node widget type alterable through code
Status:needs review» fixed

Sorry for the delay here. Thanks for the patch, added to 6.x-3.x.

#5

Status:fixed» closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

nobody click here