Adding of functionality to open widget when layer is turned on.