November Happy Hour will be moved to Thursday December 5th.

Creating a block, selectively showing only certain inputs

Vote:
 

In our site right now we currently have 4 block types to create different styles of buttons.

Each block is basically the same, it just requires a few different things: Image block needs an image. Icon button needs an icon to be chosen, etc.

I was thinking about creating one button block to handle all 4 (and potentially more) styles. I'm just not sure how possible it would be without getting confusing. For instance, if you create a new button block and choose Image button from a dropdown, could the block editor then show extra fields that were hidden before. And if you chose Icon button would it hide those fields and present other fields?

I mocked up this idea to hopefully help illustrate what I'm hoping to achieve. Is this something EpiServer can do? 

#203332
Edited, Apr 16, 2019 20:23
Vote:
 

not OTHB as far as I know. you would need to go dojo-mojo path to implement this in proper way (on client-side). Grzegorz extends a bit "All Properties" view in his blog post (https://gregwiechec.com/2015/05/extending-all-properties-view/) which might give you some hints on how it might look.

#203333
Edited, Apr 16, 2019 21:55
Vote:
 

This looks very promising, thank you!

#203355
Apr 17, 2019 15:12
Vote:
 

Another awesome blog from Greg shows how to show/hide properties depending on value thats been selected:

Best bit if that it appears to pure C# so no Dojo...

https://gregwiechec.com/2018/03/hide-tabs-and-properties-in-edit-mode/ 

#203356
Apr 17, 2019 16:27
* 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.