diff options
| author | Jan-Hendrik Willms <tleilax+studip@gmail.com> | 2024-11-27 09:39:32 +0000 |
|---|---|---|
| committer | Jan-Hendrik Willms <tleilax+studip@gmail.com> | 2024-11-27 09:39:32 +0000 |
| commit | 9faceafb621c10bb9a224ff305200ee697789e65 (patch) | |
| tree | c8ba60e1872f919ea4ad348f61af7eafb951c38f /lib/classes/PluginController.php | |
| parent | e97273674b5f5cbbbaa12fdbaf47566e8aa4f7d1 (diff) | |
introduce PluginDispatcher, fixes #4913
Closes #4913
Merge request studip/studip!3688
Diffstat (limited to 'lib/classes/PluginController.php')
| -rw-r--r-- | lib/classes/PluginController.php | 17 |
1 files changed, 10 insertions, 7 deletions
diff --git a/lib/classes/PluginController.php b/lib/classes/PluginController.php index d57a90d..867d669 100644 --- a/lib/classes/PluginController.php +++ b/lib/classes/PluginController.php @@ -6,20 +6,20 @@ * modify it under the terms of the GNU General Public License as * published by the Free Software Foundation; either version 2 of * the License, or (at your option) any later version. + * + * @property StudIPPlugin $plugin + * @property callable $_ + * @property callable $_n */ - class PluginController extends StudipController { - public function __construct($dispatcher) + public function __construct(PluginDispatcher $dispatcher) { parent::__construct($dispatcher); - if (!isset($dispatcher->current_plugin)) { - throw new Exception('Plugin missing for plugin controller!'); - } $this->plugin = $dispatcher->current_plugin; - if ($this->plugin && $this->plugin->hasTranslation()) { + if ($this->plugin->hasTranslation()) { // Localization $this->_ = function ($string) { return call_user_func_array( @@ -64,7 +64,10 @@ class PluginController extends StudipController */ public function __call($method, $arguments) { - if (isset($this->_template_variables[$method]) && is_callable($this->_template_variables[$method])) { + if ( + isset($this->_template_variables[$method]) + && is_callable($this->_template_variables[$method]) + ) { return call_user_func_array($this->_template_variables[$method], $arguments); } return parent::__call($method, $arguments); |
