Real World Example #52
Replies: 1 comment 1 reply
-
Hi @ascentcreative, I would create a custom model in your case, at the moment settings classes are more for simple settings like
Yeah at the moment it is just one dataset per settings class, though I'm thinking about adding support for collections in v3 but I'm not yet sure how to tackle this. So you could build the example you described using some custom classes but I think we want to support this kind of behavior in the future out of the box to have one settings class map on multiple items. |
Beta Was this translation helpful? Give feedback.
-
Hi,
I'm looking for some settings management for a CMS app I'm building, and this seems like an excellent package with the type management especially.
I'm just struggling to understand the concepts of the Settings classes and the groups where the values are more than just key-value pairs.
The example I am working with initially is as follows: The CMS's contact form module would have admin-configurable categories - Technical, Sales, General etc. For each category, they should be able to enter a Description and a list of recipient emails.
How would I translate this setup into Settings Classes? Or, am I going too far with it, and should just be creating a custom model for these?
Would I create a single ContactFormCategorySettings model class, which takes a label and multi-value list of recipients? Does the package allow me to have multiple instances of the settings model with different data, or does it expect only one?
If I also wanted other more general settings, say anti-spam score threshold (denoting the AS score at which I'd reject a message), would I create a 'ContactFormGeneralSettings' class, with ASThreshold as a member (and other things)?
What would I use as the groups for these? Can these be heirarchical? i.e. What group names would I use if I wanted to retrieve all ContactForm settings, something like this:
ContactForm - array containing:
Thanks! Hope I'm ok to ask this...
Beta Was this translation helpful? Give feedback.
All reactions