I’m currently creating a bake template for generating a simple search form + result list in CakePHP 3.6
i would like to have this kind of structure :
Element
[ControllerName]
form.ctp
list.ctp
[ControllerName]
index.ctp
inside index.ctp i could use
{% element ‘form’ %}
but it’s not what i want …
i would like that bake generate the 2 elements (based on bake element template ?) directly and my template in index would be to call $this-element …etc …
i think i should use the Event for generating the files but i’m not sure it is the right solution
for whose who seek to know how to do it , i found the time to make this :
in the bootstrap.php of your Theme :
EventManager::instance()->on('Bake.beforeRender.Template.edit', function (Event $event) {
// we should render form_add before
Tools::renderTemplateElement($event, 'form_add');