got this error upon adding the field
Notice: Undefined offset: 0 in vud_field_widget_form() (line 91 of /www.example.com/web/content/sites/all/modules/vote_up_down/vud_field/vud_field.module).

Added: "Vote Up/Down: Node Widget" to a view , but it changes to "Broken/missing handler" after adding

Added Vote Widget into display suite but it is not working yet (no coding at all shows up in the node display modes)

I know that the voting functionality works for nodes #1194274: Port vud_node to D7 - before i modded the node template, the voting widget appeared & worked correctly. Now we just need to get the field widget going.

I did not test the VUD field widget on an unmodified node template, but i would assume that it would bring about the same results as views or display suite.

CommentFileSizeAuthor
#9 vud_node_views.patch1.88 KBmathankumarc

Comments

damienmckenna’s picture

Subscribe.

lawnmower528’s picture

same problem. subscribe.

Sylense’s picture

+1

Sylense’s picture

anyone able to get this working yet?

Sentrashy’s picture

+1

Refineo’s picture

subscribe

dangko’s picture

+1

mathankumarc’s picture

For Display suite integration you need to create separate module with the hook hook_field_formatter_info provided by the display suite module.

like below

/**
 * Implements hook_field_formatter_info().
 */
function  my_module_ds_fields_info($entity_type){
   $fields['node']['vud'] = array(
        'title' => t('Vote Up/Down'),
        'field_type' => DS_FIELD_TYPE_FUNCTION,
        'function'	=>  'render_vud',
        'properties' => array(
          'formatters' => array(
            // @todo: expose all widgets dynamically by using vud_widget_get_names()
            'default' => 
              t('Use Vote Up/Down-module settings (currently: @current_widget)', array('@current_widget' => variable_get('vud_node_widget', 'plain'))),
            'plain' => t('Plain'),
            'alternate' => t('Alternate'),
            'upanddown' => t('Upanddown'),
            'updown' => t('Updown'),
          ),
        )
      );
  if (isset($fields[$entity_type])) {
    return array($entity_type => $fields[$entity_type]);
  }
  return;
}

/*
 * Render vote up  and down widget
 */
function  render_vud($field){
  $widget  =  $field['formatter'];
  if($widget  ==  'default'){
    $widget  =  variable_get('vud_node_widget', 'plain');      
  }
  if (($can_edit = user_access('use vote up/down on nodes')) || user_access('view vote up/down count on nodes')) {
    $node = $field['entity'];
    $tag = variable_get('vud_tag', 'vote');
    // Overrule the default widget if we get a widget parameter.
    $widget = isset($widget) ? $widget : variable_get('vud_node_widget', 'plain');
    $widget_message_code = VUD_WIDGET_MESSAGE_ERROR;
    if (!$can_edit) {
      $widget_message_code = VUD_WIDGET_MESSAGE_DENIED;
    }
    $readonly = !$can_edit;
    $variables = array(
       'entity_id' => $node->nid,
       'type' => 'node',
       'tag' => $tag,
       'widget_theme' => $widget,
       'readonly' => $readonly,
       'widget_message_code' => $widget_message_code,
      );
    return theme('vud_widget', $variables);
  }
}

Enable the module and clear the cache, now you will see the separate field for vud.

For views integration, me tooooo need help from community.

mathankumarc’s picture

StatusFileSize
new1.88 KB

I created the patch for vud_node views integration.

marvil07’s picture

Component: vud_field » vud_node
Status: Active » Needs review

Status: Needs review » Needs work

The last submitted patch, vud_node_views.patch, failed testing.

marvil07’s picture

Title: Vote Up/Down field widget not working » Vote Up/Down node views field not working
Priority: Major » Normal
Status: Needs work » Postponed
office@w3k.at’s picture

Same here when using the method described in the original post.
But using the Vote Up/Down field module worked very well.
It is located in the Fields category on the Modules page.
Disable VUD Node Module.
Add a Vote Up Down Field to your content type.
add it to you view, done.

marvil07’s picture

Issue summary: View changes
Status: Postponed » Fixed

Thanks for the patch, sorry for the enormous delay.

Status: Fixed » Closed (fixed)

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