From e91fda8aab79461aa7e1de585813b2a48da91dba Mon Sep 17 00:00:00 2001 From: Toby Zerner Date: Tue, 16 Jun 2015 17:39:47 +0930 Subject: [PATCH] Add API to add a link to an action --- framework/core/src/Extend/ApiLink.php | 28 +++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 framework/core/src/Extend/ApiLink.php diff --git a/framework/core/src/Extend/ApiLink.php b/framework/core/src/Extend/ApiLink.php new file mode 100644 index 000000000..6450ad58e --- /dev/null +++ b/framework/core/src/Extend/ApiLink.php @@ -0,0 +1,28 @@ +actions = $actions; + $this->relationships = $relationships; + } + + public function extend(Application $app) + { + foreach ((array) $this->actions as $action) { + $parts = explode('.', $action); + $class = 'Flarum\Api\Actions\\'.ucfirst($parts[0]).'\\'.ucfirst($parts[1]).'Action'; + + foreach ((array) $this->relationships as $relationship) { + $class::$link[] = $relationship; + } + } + } +}