Theming a Plugin in Croogo 3.05

32 views
Skip to first unread message

Frisches Deo

unread,
Dec 6, 2018, 8:11:51 AM12/6/18
to Croogo
Hi guys,

thank you for your work so far. I'm using Croogo 3.05 and want to extend it features. I've created a theme (which wasn't that easy, as every documentation i can find is made vor earlier Versions of the CMS) which i want to use in my plugin i'm creating right now. The Plugin is going to be a simple Backend Module with CRUD functionality and display in the frontend.
I'm stuck at how i can achieve to use my theme i created inside the views of my plugin? The CakePHP Documentation says

  // For CakePHP before 3.1
    public $theme = 'Modern';

    public function beforeRender(\Cake\Event\Event $event)
    {
        $this->viewBuilder()->setTheme('Modern');

        // For CakePHP before 3.5
        $this->viewBuilder()->theme('Modern');
    }

But how can i declare my plugin to use the theme i created and activated in the Backend of Croogo?

Thank you and Best Regards

Jérôme BUTRYN

unread,
Dec 6, 2018, 12:47:31 PM12/6/18
to Croogo
Hi

For the Frontend, use default theming system of Croogo
For you custom backend, you can set layout with a prefix in your plugin Controller for example :

class MyPluginAppController extends AppController
{
  public function beforeFilter()
    {
    if (!isset($this->request->params['admin']) && isset($this->request->params['manage'])) {
        $this->layout = 'MyPlugin.my_custom_layout_name';
    }
    ....
Reply all
Reply to author
Forward
0 new messages