我的默认收音机输入是这样的
$this->Form->radio('email_notifications', ['one','two']);
我默认有这个:
<input type="radio" id="usertype-0" value="0" name="userType">
<label for="email-notifications-0">one</label>
并且需要将这个结构改写为:
<label class="radio" for="usertype-0">
<input type="radio" id="usertype-0" value="0" name="userType">one
</label>
曾尝试使用自定义模板。它适用于“inputContainer”,但不适用于“radioContainer”。通过为单选按钮添加一个 div 来使用以下内容进行测试:
$this->Form->templates([
'radioContainer' => '<label {{attrs}}">{{input}}{{text}}</div>'
]);
但对我来说没有任何用处,因为我只得到默认结构。我做错了吗?我也尝试参考这个进行配置:Cakephp 3 multiple custom template formhelpers