Invision Community 4: SEO, prepare for v5 and dormant account notifications By Matt Monday at 02:04 PM
Sonya* Posted April 16 Posted April 16 Would it be possible to “hook” into data-ipsRating to change the output of the star elements? I have tried mixin: ips.controller.mixin('mixinName', 'core.front.core.rating', true, function () { alert('mixin'); this.before('initialize', function () { alert('before initialize'); }); this.before('_buildRatingElem', function () { alert('before _buildRatingElem'); }); }); There are three alerts. The first and second are called, the last one “before _buildRatingElem" not.
Nathan Explosion Posted April 16 Posted April 16 Is there a _buildRatingElem function in the controller registered as core.front.core.rating?
Sonya* Posted April 16 Author Posted April 16 1 minute ago, Nathan Explosion said: Is there a _buildRatingElem function in the controller registered as core.front.core.rating? This is not a controller, but a module. I suppose that is the reason the mixin does not work. I am trying with a controller now and fail again.
Nathan Explosion Posted April 16 Posted April 16 1 minute ago, Sonya* said: This is not a controller, but a module. I suppose that is the reason the mixin does not work Just taken a look at the controller, and yep...no function called that (it's off in the ips.ui.rating module) so that will be why it's not working. Mixin is for controllers. No idea what you are trying to do before the function, but as it is called in the init of ips.ui.rating then wouldn't before initialize meet the same need? (unless you need something that the init is providing? Again...no idea what you are trying to do)
Sonya* Posted April 16 Author Posted April 16 1 minute ago, Nathan Explosion said: Again...no idea what you are trying to do) I just need another output for the star rating. Either hook into how the stars are built. This does not work, as this is a module. Or send a rating remote from my template, that does not work either. For example, instead of outputting 5 stars, I would like to print out: No. Rather no Don't know Rather yes Yes The rating should be saved as usual. Just the output should be changed.
Recommended Posts