How to toggle editing on a virtual layer?

No, you can not edit a virtual layer this way. This is because a virtual layer is just a query on other layers. So you either need to edit the layers the virtual layer is based on, or save the virtual layer as a "static" file - once you have done this, you can edit that no-longer-virtual-layer.

You can only edit the query of this virtual layer.


To complete the other answer

If you edit the source layer the virtual layer should update. If you use a database as a source you may create an editable view (see this question for exemple) but keep in mind that you are still modifying the original data and not only the view.