Saving custom designer settings for reuse

Posted by Community Admin on 04-Aug-2018 21:37

Saving custom designer settings for reuse

All Replies

Posted by Community Admin on 02-Feb-2012 00:00

This one might be a little overly complex, but just wanted to throw it out there in the event anyone has tackled this.

I've built a custom control with a custom designer, settings are picking up perfectly. The control is going to be reused at multiple points on the site, but often with one of the same set of 10 "stock" settings. Is there any way to set the designer up to save these settings as they are created and then allow the user to select from a list either one of the ten, or click a custom button to expose the rest of the designer?

The only two ways I can think of doing this are:
1) Create 10 different custom controls to be reused with the settings baked in. They can derive from the existing control so that I still have some re-usability with the design, but the default controls will be locked down. Upside here would be I could change the look/feel in one place and have it update everywhere it's used on the site.
2) Hard code the default settings into the control designer. This would work fine for the settings I have defined now, but if I want to save something new down the line, I have to code it into the control. Not impossible, but not ideal.

I guess I'm looking for a "share settings" option for custom controls along the lines of sharing content for use in content blocks. Is this even possible? Any suggestions would be appreciated.

Posted by Community Admin on 02-Feb-2012 00:00

Steve,

Would saving the settings to a config file of some sort work? When the control loads, it would  parse the file and display all the different configurations to the user. When a user saves the settings, it would look through the file and, if it finds that the settings are custom, add the new configuration to the list.

That would make it easy to add in new configurations later and keep you from having to make 10 of the same controls.

-Tim

Posted by Community Admin on 03-Feb-2012 00:00

This is an excellent suggestion Tim, and actually Sitefinity has a pretty solid configuration framework built right in.

Take a look at this recent blog post: Creating Custom Configuration Settings in Sitefinity 4

you can use this to easily store the conguration, including default values.

hope this is helpful!

This thread is closed