Skip to content

Commit

Permalink
allow classes to be used as hook listeners
Browse files Browse the repository at this point in the history
  • Loading branch information
wellingguzman committed Feb 18, 2017
1 parent b77d6b5 commit 49f001c
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions api/core/Directus/Hook/Emitter.php
Expand Up @@ -197,6 +197,10 @@ public function hasFilterListeners($name)
*/
protected function addListener($name, $listener, $priority = self::P_NORMAL, $type = self::TYPE_ACTION)
{
if (is_string($listener) && class_exists($listener)) {
$listener = new $listener();
}

$this->validateListener($listener);

if ($type == self::TYPE_FILTER) {
Expand Down

0 comments on commit 49f001c

Please sign in to comment.