1

I restarted a site I was developing realizing that I didn't have a systematic approach to design, namely, I was implementing changes through both the UI/database and module code and hooks without thinking about why I was doing so.

My question is: what considerations should I take into account when deciding whether to make configuration changes through the UI or by coding a module?

Of course this only matters for things that you can do through both UI and module development like hook_menu, views, etc. Here is my list so far:

Reason for UI:

  • Ease of integration: (e.g creating a new content type through a module is a pain compared through the UI)
  • Specific-config: if you don't plan on installing this configuration on multiple sites, UI should be sufficient.

Reason for module:

  • Versioning: code can be versioned, when stored in the database it's not
  • Portability: if you plan on installing this functionality on multiple sites, then a module is pretty much a must.

Unknown:

  • Speed (database v.s. module code)?
  • I also find that if you need to use an .install file for something you don't plan on being portable, it seems pointless to add this to module code if it can be done through the UI. Is this right?
  • Other?

I'm very new to drupal development, but I'm just trying to make the right design choices. Any information you can provide would be helpful.

Thanks!

1 Answer 1

1

You should make configuration changes in code as much as possible, in particular it helps with

  1. Ease of deployment
  2. Consistency across deployment environments
  3. Consistency across developer team environments
  4. Configuration changes are tracked in version control.
  5. The required configuration for the application is in the code base.

If you haven't already, checkout the Features module for a good approach to exporting and synchronizing configuration between environments.

For example, you can build a Feature module for your

  • Views
  • Panels
  • Content Types
  • Fields etc..

and synchronize the changes in code by rebuilding the relevant feature module on dev, deploying it and reverting the feature module on the deployed environment.

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.