从 kartik/date/datepicker 中删除工具提示

Remove tooltip from kartik/date/datepicker

我在活动表单中使用了 kartik DatePicker。

use kartik\date\DatePicker;

我的活动表单字段:

    <?= $form->field($model, 'transferred_date')->widget(DatePicker::className(), [
                        'value' => date('d-M-Y', strtotime('+2 days')),
                        'options' => ['placeholder' => 'Select date ...'],
                        'pluginOptions' => [
                            'format' => 'dd-mm-yyyy',
                            'todayHighlight' => true
                        ]
    ])->label('Transferred Date');
?>

当我将鼠标悬停在日历图标上时,它会显示这样的工具提示。

我必须删除工具提示。我该怎么办?

阅读 doc 时,您可以在设置中阅读:

pickerButton: mixed the calendar picker button configuration - applicable only when type is set to DatePicker::TYPE_COMPONENT_PREPEND or DatePicker::TYPE_COMPONENT_APPEND. This can be one of the following types: string, if this is a string, it will be displayed as is (and will not be HTML encoded). boolean, if this is set to false, it will not be displayed. array, this is the default behavior. If passed as an array, it will be considered as HTML attributes for the picker button addon. The following special keys are recognized: icon, string the bootstrap glyphicon name/suffix. Defaults to 'calendar'. title, string|boolean the title to be displayed on hover. Defaults to 'Select date & time'. If this is set to false, it will not be displayed.

所以我不用测试就可以说它应该是这样的:

<?= $form->field($model, 'transferred_date')
         ->widget(DatePicker::className(), [
                    'type' => DatePicker::TYPE_COMPONENT_PREPEND,
                    'pickerButton' => ['title' => false],
                    'value' => date('d-M-Y', strtotime('+2 days')),
                    'options' => ['placeholder' => 'Select date ...'],
                    'pluginOptions' => [
                        'format' => 'dd-mm-yyyy',
                        'todayHighlight' => true
                    ]
          ])->label('Transferred Date');
?>

所以你在配置中错过了这个:

'type' => DatePicker::TYPE_COMPONENT_PREPEND,
'pickerButton' => ['title' => false],