Search code examples
impresspages

How to have 2+ AdminControllers for 1 Plugin


I have 2 Admin contollers.

PostContoller
CategoriesController

How can I Create them inside Blog Plugin, If I want. Can a plugin have more than one Controller, Admin or Public.

I tried to Create PostAdminContoller and extend AdminController, but dont know how to Call it like

?aa=Post.index


Solution

  • There are three controllers that are available by default:

    AdminController SiteController PublicController

    If you want more controllers, use routes (http://www.impresspages.org/docs/routing) but then you have to do security checks on your own:

    \Ip\Internal\Admin\Backend::userId() //check if admin is logged in

    ipAdminPermission($plugin) //check if current admin has right to access plugin.