Skip to content

Instantly share code, notes, and snippets.

@modmedia
Created January 18, 2014 21:56
Show Gist options
  • Save modmedia/8497197 to your computer and use it in GitHub Desktop.
Save modmedia/8497197 to your computer and use it in GitHub Desktop.
Populate Mura extended attribute select list with Mura feeds
<!--- Add to site Content Renderer --->
<cffunction name="feedList">
<cfargument name="columnName" type="string" required="Yes">
<cfargument name="delimiter" type="string" default=",">
<cfset var q = application.feedManager.getFeeds(siteId = $.event('siteId'),type='Local')>
<cfreturn arrayToList(q[arguments.columnName].toArray(), arguments.delimiter)>
</cffunction>
<!--- Add to config.xml.cfm --->
<attribute
name="compCollectionID"
label="Collection (optional)"
hint="Choose a Content Collection you'd like to have this component list"
type="SelectBox"
required="false"
defaultValue="none"
optionList="none^[mura]event.getContentRenderer().feedList('feedId','^')[/mura]"
optionLabelList="none^[mura]event.getContentRenderer().feedList('name','^')[/mura]" />
<!--- Or just create an extended attribute manually what is a select box with : --->
"none^[mura]event.getContentRenderer().feedList('feedId','^')[/mura]" for the option list and
"none^[mura]event.getContentRenderer().feedList('name','^')[/mura]" for the option label list
@PeterBowater
Copy link

Thank you, I had just sat down to write exactly the same thing!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment