How can I change input wrapper div class in CakePHP 3.0.0.?
My code is:
<?= $this->Form->input('mobile',['div'=>['class'=>'col-md-4'],'class'=>'form-control','label'=>false]) ?>
and it returns:
<div class="input text">
<input type="text" name="mobile" div="col-md-4" class="form-control" id="mobile">
</div>
I want output like:
<div class="col-md-4">
<input type="text" name="mobile" class="form-control" id="mobile">
</div>
For CakePHP 3.0 versions ...
... there is no way to just pass on attributes to a template. You'd have to redefine the appropriate form helper templates.
You can either change them globally by using for example
FormHelper::templates()
:or only for a specific input via the
templates
option:See also
As of CakePHP 3.1 ...
... you can use so called template variables. You can placed them anywhere in a template
and use the
templateVars
option to define the values for themSee also
This code is working in my application. I think according to your requirement, this will useful.