Try our conversational search powered by Generative AI!

Get the available languages of a block

Vote:
 

Hello,

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

REgards,

Benjamin

#77498
Nov 20, 2013 11:56
Vote:
 

Use the content repository and it's method GetLanguageBranches:

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

#77506
Nov 20, 2013 12:53
Vote:
 

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?

 

#77511
Nov 20, 2013 13:37
Vote:
 

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.

#77518
Nov 20, 2013 14:28
Vote:
 

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

#77519
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.