0
votes

My website has multiple plugins (themes). For 1 theme I want a special controller. I want that controller located in the plugin/src/controller folder.

What do I have to change to let CakePHP look if there is a controller with that name in the plugins controllers folder before it looks in the normal controllers folder?

1
Please remind that plugins and themes are different things in cakePHP! Plugins contain code and are "independet" programms while themes are just different views, e.g. a blue desktop theme, a red mobile theme, and so on! - bish
That's not really true. The reason they're actually not that much different they've been removed in CakePHP 3.0 and are simply yet another plugin. See book.cakephp.org/3.0/en/views/themes.html - floriank

1 Answers

0
votes

Write a custom route class that you'll use for the route to that controller(s).

See the routing chapter of the manual for how to do that.

Inside your route you'll implement the logic that checks if the actual controller file you expect is present or not and define a callback. You can use the route options array to define a call back as well, this would make it more re-useable.