November Happy Hour will be moved to Thursday December 5th.
November Happy Hour will be moved to Thursday December 5th.
Check out this
https://world.episerver.com/documentation/Class-library/?documentId=cms/11/A8B05F15
T Get<T>( ContentReference contentLink, CultureInfo language )
Thanks I found that earlier while searching, but I am unsure with how to write the code.
You can start with this https://world.episerver.com/documentation/developer-guides/CMS/Content/icontentrepository-and-datafactory/
Even better, take a Developer course with Episerver training
epiNew,
Why is it unhelpful to suggest that you take developer training course?
I would like to provide feedback to the community:
We solved it by adding a filter to the find function. The code included a seach carried out by Episerver Find which was pulling in content of a specific category. But instead of honoring the current language it was pulling in everything.
To fix it, we changed this:
search = search.Filter(sp => sp.IsDeleted.Match(false))
.OrderByDescending(sp => sp.PublishingDate, SortMissing.Last)
.Take(1000);
To this:
search = search.Filter(sp => sp.IsDeleted.Match(false))
.OrderByDescending(sp => sp.PublishingDate, SortMissing.Last)
.Filter(sp => sp.Language.Name.Match(ContentLanguage.PreferredCulture.Name))
.Take(1000);
So now we are pulling only content that matches the preferred culture.
If you are searching for IContentData you should only have to apply the .FilterForVisitor() filter. It's doing all filtering necessary for current visitor, eg access rights, published content, current language.
search = search.FilterForVisitor()
.OrderByDescending(sp => sp.PublishingDate, SortMissing.Last)
.Take(1000);
We have a block that pulls in content and displays it on our page. Right now, no matter what language I select in our language switcher, this is not being honored by our block.
As I am new to EpiServer and C# I think I have identified the following line of code as being the one that pulls in the data?
Can I rewrite this to only get content in the language that is currently selected by the user?
Thank you for any help.