What is better way to bake an additional common actions (like enable, moveup, movedown and other) additionally to index, view, add, edit, delete? Is there a trick that I have missed in the manuals? Or proper way will be modify CAKE/vendor/cakephp/bake/src/Shell/Task/ControllerTask.php by making branch?
0
votes
1 Answers
2
votes
After advice of jose_zap in #cakephp chanell at irc.freenode.net and some experiments I have found solution.
1) to copy
APP/vendor/cakephp/bake/src/Template/Bake/Controller/controller.ctp
to my plugin as
APP/plugins/MY_PLUGIN/src/Template/Bake/Controller/controller.ctp
2) to modify in following lines (commented original actions parsing and added my own):
// foreach($actions as $action) {
// echo $this->element('Controller/' . $action);
// }
$themeActions = ['index', 'view', 'add', 'edit', 'delete', 'moveup','movedown', 'recover', 'enable', 'disable', 'copy'];
foreach($themeActions as $action) {
echo $this->element($this->theme.'.Controller/' . $action);
}
3) to copy all files from
APP/vendor/cakephp/bake/src/Template/Bake/Element/Controller/*
to
APP/plugins/Tools/src/Template/Bake/Element/Controller/*
and add my own actions (like 'moveup','movedown', 'recover', 'enable', 'disable', 'copy' and so on)
Thats' all.