Last active
December 14, 2023 10:32
-
-
Save stevewithington/6469763 to your computer and use it in GitHub Desktop.
Mura CMS : You can easily override nearly any method in Mura with method injection. This example shows you how to do that.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<cfscript> | |
// drop this in your eventHandler.cfc | |
public any function yourMethod() { | |
// you do something here | |
} | |
public any function onApplicationLoad($) { | |
arguments.$.getBean('someBean').injectMethod('someMethod', yourMethod); | |
} | |
</cfscript> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hi Steve,
I have followed the example above. Using method injection, I am able to successfully inject my custom function into 'getImageUrl()' in ContentManager:
$.getBean('contentManager').inject('getImageURL', customGetImageUrl);
Now I have been trying to override 'hasImage()' in ContentNavBean similar to above but seems like my changes are not getting recognized at all for this particular method.
$.getBean('contentNavBean').inject('hasImage', customHasImage);
I am not sure why is it that I am able to inject my custom function into contentManager but not into contentNavBean.
Has contentNavBean been exempted from method injection?
Please find the link below to Mura Google Groups for more information:
associated image for content type "File"
Thanks in advance,
Rasleen