全体のテンプレートを変更する
テンプレートの作成
config/customized_form.php
<?php
/**
* 変更したいテンプレートのみ設定する
*/
return [
'dateWidget' => '<ul class="list-inline"><li class="year">{{year}}</li><li class="month">{{month}}</li><li class="day">{{day}}</li></ul>'
];
テンプレート読み込み
AppView.php
public function initialize()
{
$this->loadHelper('Form',['templates' => 'customized_form']);
}
CakePHP3のFormHelper標準のテンプレート一覧はこちら
FormHelper template
一時的に変更する
$this->Form->templates(['dateWidget' => '<ul class="list-inline"><li class="year">{{year}}</li><li class="month">{{month}}</li><li class="day">{{day}}</li></ul>']);
echo $this->Form->date('datecol');