I am trying to connect to an event hook_views_post_executein Drupal 7, my module called foois in sites/default/modules/features/foo.
My file foo.modulecontains a function hook_views_apidefinition defined as follows:
function foo_views_api() {
return array("version" => 3.0);
}
This function is called, but my implementation is hook_views_post_executenot defined, it is defined (in the same file foo.module) as follows:
function foo_views_post_execute(&$view) {
$seen_rows = array();
$newResults = array();
for($i = 0; $i < count($view->result); ++$i) {
if (!in_array($view->result[$i]->nid, $seen_rows)) {
$newResults[] = $view->results[$i];
}
$seen_rows[] = $view->result[$i]->nid;
}
$view->result = $newResults;
}
I was on drupal, googled API / hook documentation and read every blog post I could find. I just can't get it to work. The hook is not called. I suppose I did something simple because I am not a drupal developer or PHP developer.