1

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)?

Jas Panesar
  • 6,597
  • 3
  • 36
  • 47
Dave Long
  • 9,569
  • 14
  • 59
  • 89

1 Answers1

2

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

Paul Perigny
  • 973
  • 5
  • 12