0

we have just upgraded to PHP 8 and now I’m getting an error message when I load a view using Dialog

Undefined constant kartik\dialog\Dialog::ICON_OK

the code for loading the Dialog is:

echo Dialog::widget([
    'libName' => 'krajeeDialogCust', // a custom lib name
    'options' => [  // customized BootstrapDialog options
        'size' => Dialog::SIZE_LARGE, // large dialog text
        'type' => Dialog::TYPE_SUCCESS, // bootstrap contextual color
        'title' => 'Multi-Assign tasks confirmation',
        'buttons' => [
            [
                'id' => 'cust-btn-1',
                'label' => 'Make Changes',
               'icon' => Dialog::ICON_OK,
                'action' => new JsExpression("function(dialog) {
                // Checks if weekend option has been ticked
                    if(document.getElementById('accept')) {                                    
                        var new_date = new Date(document.getElementById('bulktasksearch-due_at').value);
                        var date_day = new Date(new_date).getDay();
                        const months = ['Jan', 'Feb', 'Mar','Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'];

                    //if weekend is not ticked change the date to the next Monday
                        if(document.getElementById('accept').checked == false){
                            switch(date_day){ 
                                case 0:
                                    var formatted_date = (new_date.getDate()+1) + '-' + months[new_date.getMonth()] + '-' + new_date.getFullYear();
                                    document.getElementById('bulktasksearch-due_at').value = formatted_date;
                                    break;
                                case 6:
                                    var formatted_date = (new_date.getDate()+2) + '-' + months[new_date.getMonth()] + '-' + new_date.getFullYear();
                                    document.getElementById('bulktasksearch-due_at').value = formatted_date;
                                    break;
                                default:
                                    break;
                            }
                        }
                    }
                    document.getElementById('do-form').submit();
                }")
            ],
            [
                'id' => 'cust-cancel-btn',
                'label' => 'Cancel',
                'icon' => Dialog::ICON_CANCEL,
                'cssClass' => 'btn-outline-secondary',
                'hotkey' => 'C',
                'action' => new JsExpression("function(dialog) {
                    if (typeof dialog.getData('callback') === 'function' && dialog.getData('callback').call(this, false) === false) {
                        return false;
                    }
                     return dialog.close();
                }")
            ],
        ]
    ]
]);
Undefined constant kartikdialogDialog::ICON_OK
Helen Postle Asked question August 20, 2024