openrat-cms

OpenRat Content Management System
git clone http://git.code.weiherhei.de/openrat-cms.git
Log | Files | Refs | README

commit 952657369e00a21b78ca9e66d0b73bb1dce795c6
parent 122f2e330f5a034786debc779f117b826d545446
Author: Jan Dankert <develop@jandankert.de>
Date:   Sun,  1 Nov 2020 22:31:13 +0100

Fix: Method 'availableView' was missing.

Diffstat:
Mmodules/cms/action/BaseAction.class.php | 34++++++++++++++++++++++++----------
1 file changed, 24 insertions(+), 10 deletions(-)

diff --git a/modules/cms/action/BaseAction.class.php b/modules/cms/action/BaseAction.class.php @@ -1,18 +1,32 @@ <?php -namespace cms\action { +namespace cms\action; +/** + */ +class BaseAction extends Action +{ - /** - */ - class BaseAction extends Action - { + public function __construct() + { + parent::__construct(); + } - public function __construct() - { - parent::__construct(); - } - } + /** + * Gets all available View-Methods in this Action. + */ + public function availableView() + { + $viewMethods = array_map( function($methodName){ + // Removing the 'View' from the end of the method name + return substr($methodName,0,strlen($methodName)-4); + }, array_filter(get_class_methods($this), function ($methodName) { + // Filter only View methods + return substr($methodName, -4, 4) == 'View'; + })); + + $this->setTemplateVar('views', $viewMethods); + } } \ No newline at end of file