Hi,

In displaysuite I created a custom field with a link for adding a flag.

But only the first one is beïng rendered?

<?php
 
print flag_create_link('my_flag_type', $entity->nid);
?>

What am I doing wrong?

Comments

easycombvba’s picture

Error that shows up:

Trying to get property of non-object in flag_entity->applies_to_entity() line 124 of flag_entity.inc

joachim’s picture

It sounds like your $entity is not defined.

joachim’s picture

Status:Needs work» Fixed
easycombvba’s picture

Status:Fixed» Needs work

Hi Joachim,

I have checked this case with the following code:

<?php
 
if (isset($entity->nid)) {
print
flag_create_link('compare', $entity->nid);
print_r($entity->nid);
}
?>

The node id is rendered at every product. But the the error still pops up.

So $entity must be defined.

joachim’s picture

Status:Needs work» Active

Can you follow the code and figure out where we lose it?

Alternatively, it would probably be more productive to focus your efforts on adding support for DS to Flag as a patch. I assume from your original post that you're pasting PHP code into something?

Though, have you tried placing the Flag pseudofields that are now available in 3.x?