Question

I have a custom button created in the ribbon of tridion.

If an item either Component/Page has been selected i need to get the info whether the item is localized or not. Based on that custom button will be enabled/disabled.

For getting the tcmid of the selected component/page i am currently writing as

selection.getItem(0); in my javascript.

Similarly, how can i get the localized info of the selected item(Component/Page)

Was it helpful?

Solution

Just check the isLocalized method of the item:

var itemUri = selection.getItem(0);
var item = $models.getItem(itemUri);
if (item.isLocalized())
{
   // Do your magic here
}

I've left out the error handling and potential loading of the item, for simplicity.

OTHER TIPS

The Properties and Methods of the UI JavaScript Objects can be found in the SDL Tridion 2011 SP1 GUI Extension API documentation which you can find on http://docportal.sdl.com/sdltridion

Just check in the Tridion.ContentManager Namespace and you will find things like Component.getInfo() and Component.getBlueprintHierarchy() from which you can extract this kind of information.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top