I would like to wrap the buttons in the DIV element, how to do it?
- Button type submit
- Button button - js function class
I don’t want to attribute around $this->Form->control
div to the code, but I’d like to call it one function so that it wraps itself.
eg:
echo $this->Form->allControls($fields_buttons, ['legend' => false]);
Thank you
yes I know, but it only wraps one element, how to make it wrap more elements at once?
Since the ->allControls()
function doesn’t have its own template because it basically just calls ->controls()
on the given/model fields you would have to make your own / extend the FormHelper and overwrite that function.
See Helpers - 4.x how to do that.
Solution is:
$this->start('buttons');
echo $this->Form->button('Send');
echo $this->Form->button('Back');
$this->end();
echo $this->Html->div('buttons', $this->fetch('buttons'));