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

floleft’s picture

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

Jerome F’s picture

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?

gmush’s picture

Temporary you may insert:

$teaser ='';
return _addtoany_create_button($node, $teaser);
Jerome F’s picture

Status: Active » Needs review
StatusFileSize
new341 bytes

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

mstrelan’s picture

Version: 7.x-3.1 » 7.x-3.x-dev
StatusFileSize
new559 bytes

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.

jmaties’s picture

StatusFileSize
new714 bytes

Here is our patch works ;)

Jerome F’s picture

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).

Jerome F’s picture

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);
micropat’s picture

Status: Needs review » Needs work
micropat’s picture

Status: Needs work » Fixed

Fixed in dev.

Status: Fixed » Closed (fixed)

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