我正在尝试从Yii2中的Kartik DatePicker中删除标题部分。我尝试使用以下代码。
echo \kartik\date\DatePicker::widget([
'model' => $employmentMod,
'form' => $form,
'attribute' => "[$index]emp_date_from",
'options' => [
'placeholder' => 'Select date ...',
'template' => '{widget}{error}',
'class' => 'detaildatepicker',
],
'pluginOptions' => [
'todayHighlight' => true,
'autoclose' => true,
'format' => 'yyyy-mm-dd',
]
]);
它仍然无效。我传递了$ form,因为我需要显示验证错误。有人能告诉我如何在这里使用模板吗?
答案 0 :(得分:0)
为此窗口小部件添加type
选项以指定组件的标记:
echo \kartik\date\DatePicker::widget([
'model' => $employmentMod,
'form' => $form,
'attribute' => "[$index]emp_date_from",
'options' => [
'placeholder' => 'Select date ...',
'template' => '{widget}{error}',
'class' => 'detaildatepicker',
],
'type'=> \kartik\date\DatePicker::TYPE_INPUT,
'pluginOptions' => [
'todayHighlight' => true,
'autoclose' => true,
'format' => 'yyyy-mm-dd',
]
]);