0
我試圖在我的cakephp 3應用程序中爲每個輸入添加一個默認類。我想要什麼 例子:cakephp 3將默認類添加到輸入
輸入: <echo $this->Form->control('email');
輸出: <input class="form-control" class="is-invalid"/>
所需的輸出: <input class="form-control is-invalid"/>
爲了這個,我已編輯的表單助手
$this->viewBuilder()->setHelpers([
'Form' => [
'templates' => [
'input' => '<input class="form-control" type="{{type}}" name="{{name}}"{{attrs}}/>'
]
]
]);
輸入模板
問題是{{attrs}}
可能包含其他類。你有什麼想法如何做到這一點?
還有可用的插件,援助與創建引導兼容輸出:** HTTPS://github.com/FriendsOfCake/awesome-cakephp#templating**。 – ndm
嗨,我知道,但插件僅與引導程序3一起工作。我使用bootstrap 4,它有很多變化。 – Matoran