Add $ui hash and onAttach event.