Saturday, September 6, 2014

Make AppController variable available in pluginAppController

In the AppController, I want to put the plugin, controller and action in variables just like this:

class AppController extends Controller
{
   
public $components = array(
       
'DebugKit.Toolbar',
       
'Session'
   
);
   
   
public function beforeFilter()
   
{
        $plugin
= $this->request->params['plugin'];
        $controller
= $this->request->params['controller'];
        $action
= $this->request->params['action'];
   
}
}

Now, I've made a plugin called "CoasterCms". I thought every plugin got all the variables stored in AppController so I could get the plugin variable:

<?php

class CoasterCmsAppController extends AppController
{
    public $helpers = array(
        'Html',
        'Form',
        'Session'
    );
    
    public $components = array(
        'Session',
        'Paginator'
    );
    
    public function beforeFilter()
    {
        debug($plugin);
    }
}

However, it's not showing anything at all... What's the reason and how can I fix this?

--
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP

---
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscribe@googlegroups.com.
To post to this group, send email to cake-php@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php.
For more options, visit https://groups.google.com/d/optout.

No comments: