Is it possible to change all the toast messages to SweetAlert toast?

v2024

function Row_Inserting($rsold, &$rsnew) {
    $currentUserName = CurrentUserName();

    $checkBorrowedSQL = "SELECT COUNT(*) AS borrowed_count FROM transactions WHERE borrower_name = '$currentUserName' AND status = 1";
    $row = ExecuteScalar($checkBorrowedSQL);

    if ($row > 1) {
        $this->setFailureMessage("<script>
        Swal.fire({
            icon: 'error',
            title: 'Oops...',
            text: 'You already have a borrowed item and cannot borrow again.',
            toast: true,
            position: 'top-end',
            showConfirmButton: false,
            timer: 3000,
            timerProgressBar: true
        });
        </script>");
        return FALSE; 
    } else {
        return TRUE;
    }
}

i am currently using this to set a toast message and it is quite husstle if all the tables and message will code like this

You may create your own Extensions to do that.