There is already code for a field implementing vote up down on the git repository.

IMHO making 4 submodules for vud implementation is too much, and since we can replicate most of the work done on those modules through a general field implementation, I am completely in favour to deprecate the ones mentioned in the title.

In the other side, I think this can be a big win because it would be a lot code less to maintain.

This idea was mentioned on the original D7 port some time ago: #749438-95: Port Vote Up/Down to D7

Comments

drnikki’s picture

I think that's a great idea. Can you (or have you already) committed that first patch that lets VUD run on d7 so we can help you do some of the rest of the work?

marvil07’s picture

Great to know about it, yeah, code is there in two branches: 7.x-1.x and vud_field. I was hoping to get it fully working but you are right, I will merge the code at vud_field onto 7.x-1.x and then remove that branch.

Update: Last code is now on 7.x-1.x

mnbroderick’s picture

Just wondering, do you want people to start testing with the field module instead of the old submodules?
And we cannot remove those extra submodules yet because that is how the views implementations are working, right?

I also assume we'll still be able to just call the related widget in the tpl.php ourselves if we don't want to display it as a field.

boran’s picture

I'd be happy to test and use the field version of vud.
- pulled from git and enabled vud_field.
- in the content type a Vote field was added of Field/Widget="Vote UpDown".
- under Manage Display the format for vote was set to "Vote UpDown(default)"

The widget is not appearing.

Errors:
php Notice: Undefined index: vud_widget in vud_field_field_formatter_view() (line 160 of /disk2/www/drupal-7.8/sites/all/modules/drupal.org.git/vote_up_down/vud_field/vud_field.module)
php Notice: Undefined index: votingapi_tag in vud_field_field_formatter_view() (line 161 of /disk2/www/drupal-7.8/sites/all/modules/drupal.org.git/vote_up_down/vud_field/vud_field.module).

The $items array is empty in vud_field_field_formatter_view().
Strangely, If I edit and save a node, then the widget appears (and $items contains vud_widget/tag). This is the case for all nodes.

P.S: I still think vud_node is needed, for example for sites migrating from D6 and wishing to preserve votes.

vlkff’s picture

I will take care of that bug and provide a patch

vlkff’s picture

Actually it is related to http://drupal.org/node/1365382.
Duplicated the comment there too.

The problem is that the field items is empty before node object is saved (or resaved how it is described in note#4) with values for items provided by
I solved the problem with hook_field_prepare_view() , in the same way as default image implemented in image.module, and as for me it is a good solution.

But while a patching I noticed that you can't change voting settings for specific entity and in terms of that, storing 'vud_widget' and 'votingapi_tag' for each entity is useless.
So I think that we have to make voting settings configurable for a particular entity too or rework the data storing. Making voting settings configurable for a particular entity looks more attractive for me , because that feature will be required by users, but probably it is an object of discussion.

marvil07’s picture

@Nikot: vud_field is a standard field, so views will recognize it, and can show it. Yeah, if you now what you are doing you can do things manually always, based on the api provided by vud module, but hopefully you don't need to do that.

@boran: I guess that errors are gone now. About sites coming from D6, I plan to make an upgrade path, see #1363928: Upgrade paths from vud_{node,comment,term} to vud_field

@vlkff: Your comment at 6 answered in context at #1365382-4: Preload vud_field based on field settings

boran’s picture

FYI, I have vud_node/comment working enough for me on D7 (with upgrade from D6) that I use for one specific site. Only a subset of vid is being used.
I can put the code in a sandbox if it helps, but I guess you want to kill vud_node/comment and get us on fields :-)

kingdee40’s picture

I've been using the vud_field for a couple weeks now everything seems to be working ok. I was just wondering if anyone was able to sort the view based on the number of votes. Again I am only using the vud field.

mgifford’s picture

Been over a year on this issue. Any thoughts about the patch in #6?

Chrissuli’s picture

Issue summary: View changes

So where do I find the vud_field!?

According to the 'search' There do not appear to be any registered modules by that name, nor are there any links to it from other dependent modules.

Can anyone send me the link please?

Kr,
Chris

kingdee40’s picture

It's not a separate module, it's part of the vud module.

  • marvil07 committed 73f9e14 on 8.x-1.x
    Issue #1295574: Removes vud_{node,comment,term} modules.
    

  • marvil07 committed 73f9e14 on 7.x-2.x
    Issue #1295574: Removes vud_{node,comment,term} modules.