Try our conversational search powered by Generative AI!

Get the available languages of a block



I have a block but how can I enumerate and get this block in the different available languages?



Nov 20, 2013 11:56

Use the content repository and it's method GetLanguageBranches:

IEnumerable<T> GetLanguageBranches<T>(ContentReference contentLink) where T : IContentData;

Nov 20, 2013 12:53

This work for pages but how can I do that for a block? Because I don't know how to create a ContentReference from a block who inherit from BlockData?


Nov 20, 2013 13:37

Either you have a block as a property on a parent model, for instance a page. Then you should check the page. If it's a shared block then you should have a reference to that block (either through a property or as part of a property, for instance a content area) and you can then use that reference.

Nov 20, 2013 14:28

Just to clarify, if it is a shared block instance you can cast the instance to IContent.

Nov 20, 2013 14:30
This thread is locked and should be used for reference only. Please use the Episerver CMS 7 and earlier versions forum to open new discussions.
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.