Skip to content

Commit

Permalink
add a filter hook for specific request method
Browse files Browse the repository at this point in the history
  • Loading branch information
wellingguzman committed Feb 17, 2017
1 parent 1ab842c commit 4b19121
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions api/core/Directus/Application/Application.php
Expand Up @@ -158,9 +158,15 @@ protected function triggerResponseFilter($data, array $options)
]
]);

$method = strtolower($this->request()->getMethod());
$payload = $this->triggerFilter('response', $payload);
$payload = $this->triggerFilter('response.' . $method, $payload);
if ($meta['table']) {
$payload = $this->triggerFilter('response.' . $meta['table'], $payload);
$payload = $this->triggerFilter(sprintf('response.%s.%s',
$meta['table'],
$method
), $payload);
}

return $payload->data;
Expand Down

0 comments on commit 4b19121

Please sign in to comment.