Try our conversational search powered by Generative AI!

Shared filed among all blocks of specific type

Vote:
 

Hi,

 

In my application I want to have a possibility to have a shared field among all instances of the same block type. I want this field to be editable from any of this blocks. is it possible to do that?

 

Just an example of why do I want to do that. I have page where I display the products of different types: mobile phones, accessories, data packages, etc. So, I have a ProductListBlock and a ProductBlock blocks. ProductListBlocks have a collection of Product blocks:

 

[Ignore]
public virtual IEnumerable<ProductBlock> Products { get; set; }

 

On a product block there some pieces of text, that should be localized and should be the same for all product types. For instance, label Read more for phones a Show details for tablets.

 

What is the standard approach for doing that?

#85459
Apr 25, 2014 13:52
Vote:
 
#85464
Apr 25, 2014 15:14
Vote:
 

You could use the language files for the text.

And then for letting the editor change it I guess you would have to create a custom property that would read the langfile and present it to the editors. Check Mathias LanguageFileEditor for inspiration. 

#85465
Apr 25, 2014 15:21
Vote:
 

Language files are not an option n our project

#85496
Apr 28, 2014 13:54
Vote:
 

If you can't use the Language files then I can't think of a standard way of doing it.

#85504
Apr 28, 2014 15:34
Vote:
 

The thing you could do is to have a ContentReference field in the original blocks. 

Then, you fill in this ContentReference on save event with another block that contains only your field. So, when this block with one property is edited, it's shared between other blocks.

#86988
Jun 05, 2014 17:28
* 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.