Skip to content

Instantly share code, notes, and snippets.

@kgiszewski
Last active August 29, 2015 14:18
Show Gist options
  • Save kgiszewski/38c20f271b63720edad3 to your computer and use it in GitHub Desktop.
Save kgiszewski/38c20f271b63720edad3 to your computer and use it in GitHub Desktop.
//Register some JS with Umbraco
//~/App_Plugins/ArchetypeLabelTemplates/package.manifest
{
"javascript": [
"~/App_Plugins/ArchetypeLabelTemplates/urlpicker.js"
]
}
//Define your label code here
//~/App_Plugins/ArchetypeLabelTemplates/urlpicker.js
var UrlPickerTemplate = {};
UrlPickerTemplate.getTitle = function (value, scope) {
//this is the property model
if (value) {
return value.meta.title;
}
//if you wanted to get the name of the content instead, you'd have to get it from the server here since it's not in the model
return "";
};
//Use a function in your config
//Archetype config GUI
Label Template: {{UrlPickerTemplate.getTitle(nameOfPropertyAlias)}}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment