Last active
August 29, 2015 14:05
-
-
Save ronnieduke/5f630319b048f2ff0d9c to your computer and use it in GitHub Desktop.
Get Mura Site's Custom Image Sizes to use in a component or any other extended attribute
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
<theme> | |
<imagesizes> | |
<imagesize name="carouselimage" width="939" height="479" /> | |
</imagesizes> | |
<extensions> | |
<extension type="Component" subType="Slider" hasBody="0"> | |
<attributeset name="Slider Options" container="Basic"> | |
<attribute | |
name="sImageSize" | |
label="Image Size" | |
hint="Enter the size of the images to be used" | |
type="SelectBox" | |
defaultValue="" | |
required="false" | |
validation="" | |
regex="" | |
message="" | |
optionList="small^medium^large^[m]$.getCustomImageSizes()[/m]" | |
optionLabelList="small^medium^large^[m]$.getCustomImageSizes()[/m]" /> | |
</attributeset> | |
</extension> | |
</extensions> | |
</theme> |
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
<!--- Add this to your theme's eventHandler.cfc ---> | |
<cfscript> | |
// Get the site's custom image sizes | |
public any function getCustomImageSizesQ(){ | |
return application.settingsManager.getSite($.event('siteid')).getCustomImageSizeQuery(); | |
} | |
//return a caret dilemeted list to use in an extended attribute | |
public any function getCustomImageSizes() { | |
var rs = getCustomImageSizesQ(); | |
return ValueList(rs.name, '^'); | |
} | |
</cfscript> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment