开发者

Accessing the Mura Component Bean from a Plugin

I am working on a Mura开发者_开发技巧 plugin that uses a mura tag to pull in a component and use it on the page. Essentially my plugin needs to call $.dspObject('component',Arguments.componentid). Since the mura scope isn't available within the plugin method then I am guessing that I need to pull in a component bean, but I have no idea how to do that.

<cffunction name="showPlayer" access="public" output="false" returntype="String">
    <cfargument name="component" type="string" required="true" hint="The ID of the component that contains the playlist." />

    <!--- Create the body content --->
    <cfsavecontent variable="bodycode">
        <cfoutput>#$.dspObject('component',Arguments.component)#</cfoutput>
    </cfsavecontent>
</cffunction>

That is a very stripped down version of the method (the full eventHandler can be found on GitHub.

So how would I rewrite my code to pull the component bean out (or whatever I need to do for it)?


There are several ways possible:

<cfargument name="$">

OR

var $=application.ServiceFactory.getBean(“muraScope”);

OR

var $=getServiceFactory().getBean(“muraScope”);

OR

   var $=getBean(“muraScope”);

See MuraCMS Programmers Guide and cfobject.cfc

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜