strange, i created a search api view on an index and since there's no way to add a relationship to the flag (though i suppose i could index them, not sure) i used the php field and inserted this snippet:

<?php
print flag_create_link('bookmarks', $data->entity); 
?>

it was working fine - showed the correct flag/unflag links with ajaxy goodness - but then suddenly stopped worked and gave me errors.

is there something that should be going into the preprocess options field? there's the option to use setup code, but i have no idea what that means in the view or what it should say/look like

setup code option says, "If checked, you can provide PHP code to be run once right before execution of the view. This may be useful to define functions to be re-used in the value and/or output code." - right now i'm running the snippet in the output code

any/all thoughts welcome.

CommentFileSizeAuthor
#2 2013-10-12 11.49.25 am.jpg79.36 KBzilla
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

joachim’s picture

You may want to take a look at #1362298: Independent views query backend flag links.

> but then suddenly stopped worked and gave me errors

What errors did you get?

zilla’s picture

FileSize
79.36 KB

a whole bunch:

Warning: array_key_exists(): The first argument should be either a string or an integer in flag_flag->fetch_entity() (line 341 of /srv/bindings/.../code/sites/all/modules/flag/includes/flag/flag_flag.inc).
Warning: Illegal offset type in flag_flag->fetch_entity() (line 343 of /srv/bindings/.../code/sites/all/modules/flag/includes/flag/flag_flag.inc).
Warning: Illegal offset type in flag_flag->fetch_entity() (line 345 of /srv/bindings/.../code/sites/all/modules/flag/includes/flag/flag_flag.inc).
Notice: Trying to get property of non-object in flag_entity->applies_to_entity() (line 124 of /srv/bindings/.../code/sites/all/modules/flag/includes/flag/flag_entity.inc).
Warning: Illegal offset type in flag_get_user_flags() (line 2004 of /srv/bindings/.../code/sites/all/modules/flag/flag.module).
Recoverable fatal error: Object of class stdClass could not be converted to string in DatabaseStatementBase->execute() (line 2168 of /srv/bindings/.../code/includes/database/database.inc).

strange - here's a snap of what i'm putting into the field (value code blank btw)