I am making a application where I need to create a element so that I can copy paste the element file into another plugin's element without changing anything.
For that I need to have a dynamic piece of code which can automatically have the current plugin directory name. I have looked all over for this solution but it seems that not much people have woked on CakePHP 3 or maybe its simple enough and I'm dumb to find it.
I tried using $this->request
or $this->params
but no luck with these.
Thanks in Advance.
You can use $this->plugin
to have the current plugin directory name.
In fact even in future whenever you are stuck in a situation like this and you don't find any function to get information related to current plugin, controller, model etc., then you can simply print $this
and see if it has the info related to what you want. If it has, then you can access the keys to have the value you want.