Having Controller and ControllerAdmin class is confusing #6151
Labels
Task
Indicates an issue is neither a feature nor a bug and it's purely a "technical" change.
Milestone
Currently, if a user generates a
Controller
, the generated template is extendingPiwik\Plugin\Controller
. If he wants to display the page in the admin he has to change the extended class toPiwik\Plugin\ControllerAdmin
and also extend a different template. Having to extend a different template (admin.twig instead of dashboard.twig) is ok for me.Is it possible that we merge those two controllers? For having backwards compatibility either a new universal Controller class or everything in
Controller
? I don't think it would be too complex to merge everything fromControllerAdmin
intoController
but didn't have a deep look. This would be best.Alternatively we should have two files in each plugin
Controller.php
andControllerAdmin.php
along with two different commands to generate them and so on. We'd then have to adjust the router to also have a look in ControllerAdmin and Controller. If an action is defined in both classes which one would be executed? I'd not recommend this solution and would prefer a unified controller.How to define / create / extend a controller should not depend on where it is displayed. A controller should not care about such things. The view is there for this.
Seeing this definitely mid term and rather sooner than later as part of making our API's better/really good before adding new features.
Part of this issue should also be to document which default view variables are available when extending which template etc. Eg
siteName
etcThe text was updated successfully, but these errors were encountered: