1

I hope this is the right place to post this, it's more a question on MVC for plugin development.

I'm developing a plugin to extend SproutForms to add users to Campaign Monitor lists. So far I've got the interface where the user can submit their API key and List ID. I then use these to pull in information about the list and add it to the db in pluginname_forms.

Now, I also want to pull in the custom fields for that list and store them in the pluginname_formFields table.

From an MVC point of view, should I keep this in the service that deals with the list data or create a new service which deals with the custom fields data?

1 Answer 1

3

Well, it looks like Sprout Forms itself prefers separate services for everything (they'd be some big services if they weren't,) but Craft does bundle closely-related things together sometimes - FieldsService deals with both fields and groups, TagsService with both tags and tag groups for example.

Personally I just look at how much code there is, if I start getting lost/sick of scrolling and there's more than one 'thing' I'm dealing with, or if the existing service is already pretty big, then I break it out into separate services.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.