Project:Share Buttons (AddToAny) by Lockerz
Version:7.x-3.x-dev
Component:Code
Category:bug report
Priority:normal
Assigned:Unassigned
Status:closed (fixed)

Issue Summary

Hi there,

I am facing a bug warning when using addtoany in my views (where I am showing my nodes in teaser mode on front page):
the warning is: "Notice: Undefined variable: teaser in addtoany_handler_field_addtoany_link->render() (line 23 of /var/www/html/multiinstall/africanew/sites/all/modules/addtoany/views/addtoany_handler_field_addtoany_link.inc)."

Please let me know what should I do about it.

Many thanks in advance,
Perry Jain.

Comments

#1

This is still occurring with the latest dev (2011-Mar-07).

#2

Version:7.x-3.0» 7.x-3.1

Hi, I used the Node: AddToAny link in a view using fields and I receive the same error

Notice: Undefined variable: teaser in addtoany_handler_field_addtoany_link->render() (line 22 of (...)/sites/all/modules/addtoany/views/addtoany_handler_field_addtoany_link.inc).

here's the line:

return _addtoany_create_button($node, $teaser);

How should that be changed?

#3

Temporary you may insert:

$teaser ='';
return _addtoany_create_button($node, $teaser);

#4

Status:active» needs review

it works, tested with facebook and twitter in my views, modification in attached patch

AttachmentSize
teaser_var_views_handler-1079696-4.patch 341 bytes

#5

Version:7.x-3.1» 7.x-3.x-dev

There is no need for _addtoany_create_button() to even have the $teaser parameter since it is not used, so therefore there is no need to pass it from addtoany_handler_field_addtoany_link::render(). I'll leave the $teaser parameter existing because it seems to have some relevance, but here is a patch that allows the views integration to just fall back to the default, which is FALSE rather than an empty string.

AttachmentSize
addtoany-1079696-views_integration_in_teaser.patch 559 bytes

#6

Here is our patch works ;)

AttachmentSize
addtoany_handler_field_addtoany_link.patch 714 bytes

#7

With After applying last patch in #6 and the patch in http://drupal.org/node/1316274#comment-5142072, which removes the "teaser" notices, I still get some notices about the node title variable :

Notice: Undefined property: stdClass::$node_title in addtoany_handler_field_addtoany_link->render() (line 20 of (...)/sites/all/modules/addtoany/views/addtoany_handler_field_addtoany_link.inc).

#8

When the view doesn't use the title field, the notice mentionned earlier appears. When the content title field is used I get a fatal error. So temporarilly, waiting for a correct patch by someone who knows php, I used this code, which removes the notice, but doesn't allow addtoany to display the node title :

  function render($values) {
    $node = new stdClass();
    $node->nid = $values->nid;
    $node->title = '';
    $teaser = '';
  return _addtoany_create_button($node, $teaser);

#9

Status:needs review» needs work

#10

Status:needs work» fixed

Fixed in dev.

#11

Status:fixed» closed (fixed)

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

nobody click here