converted working code to create plugin
added widget code to plugin