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?

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


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


[Display(
	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:

[UsedImplicitly]
[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
{
	[Display(
		Name = "Categories A (OR)",
		Description = "Content categories which should be connected by OR",
		Order = 10)]
	[ArticleCategories]
	[CultureSpecific]
	public virtual IList<ContentReference> CategoriesOr { get; set; }

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

	[Display(
		Name = "Authors",
		Description = "Authors",
		Order = 30)]
	[AllowedTypes(typeof(PersonBlock))]
	[CultureSpecific]
	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.

#290851
Edited, Oct 31, 2022 14:12
Vote:
 

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. 

#290869
Oct 31, 2022 20:08
Vote:
 

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

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