I would like to perform a query to find the node flagged with a "myflag" based on a node field value. Is it possible to use EntityFieldQuery to accomplish that? If not, how can I use Views api to do it?


Don't need to use EntityFieldQuery or views to perform this flag module has already give function to get is_flagged(). All you need to call functions like.

$flag = flag_get_flag('myflag');
if($flag && $flag->is_flagged($node->nid)) {
  print "This node is myflag!";
  • tanks for you fast answer, But how can I query the nodes form database to perform the " is_flagged" test on them – Younes TechLab Sep 15 '15 at 20:45

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.