Drupal Views Datasource and Flag Links I want to use Views Datasource module to output JSON, i then want to construct the JSON output using REACT JS or alike. I am currently stuck on how to output the Flag Link, it just comes back with an OPS field. Ideally i want this as a plain link so I can trigger it through jquery/ajax.





UPDATE: as requested using the php field i managed to get the output i was after which is something like:
Unfortunately I couldn't get the perfect solution to this so I had to use Views PHP. Remember to add a hidden field for the nid of the node

&lt;?php
$link = flag_create_link('MyFlagMachineName', $row-&gt;nid);
preg_match_all('/&lt;a[^&gt;]+href=([\'"])(.+?)\1[^&gt;]*&gt;/i', $link, $result);
if (!empty($result)) {
  echo $result[2][0];
}
?&gt;