CakePHP 3.x checkbox formatting issue

ぐ巨炮叔叔 提交于 2019-12-04 14:15:38

I would have thought the nestedInput would work but even if it did, you don't want to add that to every input you create throughout the website.

CakePHP 3 uses string templates to build form controls. You can modify them to suit your needs.

By default the checkbox is using the nestingLabel template so if you want to stop all inputs from being nested you can change the template.

// src/View/AppView.php

$this->loadView('Form', [
    templates => [
        'nestingLabel' => '<label{{attrs}}>{{text}}</label>{{hidden}}{{input}}'
    ],
    // [More helper default config overrides][2]..
])

For more control over your helpers you can create your own that extends one of the core helpers.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!