Virtual Happy Hour this month, Jun 28, we'll be getting a sneak preview at our soon to launch SaaS CMS!

Try our conversational search powered by Generative AI!

How to make local block localizable in one property but not in other?

I have a page with two properties that use the same local block ArticlePageFilterBlock:

	Name = "Overview Definition",
	Description = "Defines overview parameters",
	GroupName = SystemTabNames.Content,
	Order = 1)]
public virtual ArticlePageFilterBlock OverviewDefinition { get; set; }

	Name = "Render filter",
	Description = "Defines which elements are to be shown in the overview list.",
	GroupName = SystemTabNames.Content,
	Order = 2)]
public virtual ArticlePageFilterBlock RenderFilter { get; set; }

The first has properties which should not be localizable, so not have the CultureSpecific attribute. But the second should be localizable. Is that possible?

Here is that block:

[ContentType(DisplayName = "ArticlePageFilterBlock",
	GUID = "35AC1BED-64CA-44D4-878C-89B479F09F04",
	Description = "Enables configuration of filtering and sorting of the list of articles",
	AvailableInEditMode = false)]
public class ArticlePageFilterBlock : BlockData, ITeaserItem, ISliderArticle
		Name = "Categories A (OR)",
		Description = "Content categories which should be connected by OR",
		Order = 10)]
	public virtual IList<ContentReference> CategoriesOr { get; set; }

		Name = "Categories B (AND)",
		Description = "Content categories which should be connected by AND",
		Order = 20)]
	public virtual IList<ContentReference> CategoriesAnd { get; set; }

		Name = "Authors",
		Description = "Authors",
		Order = 30)]
	public virtual IList<ContentReference> Authors { get; set; }

	public Func<ArticlePage.ArticlePage, bool> GetFilter()
		ArticlePageFilter articlePageFilter = new ArticlePageFilter(Authors, CategoriesOr);
		return articlePageFilter.GetFilter();

So all these properties in the local block should be CultureSpecific only in the second property of the page that uses them.

Edited, Oct 31, 2022 14:12

Would it be possible to make two versions of the Local Block one which has Culture Specific Properties and another which does not, both these would inherit the Same Base Class for business logic purposes. 

Oct 31, 2022 20:08

Or create a custom validation attribute stops the user from saving the block when its edited in a language other than the master language.

Nov 07, 2022 0:39
* 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.