3

I have a site with drupal commons distribution. I updated the existing content type to add some fields which made the feature in overriden state. Now, I am not sure the best practice to follow. Should I update the feature in profiles/commons/modules/... or is there another way to update the existing content type without changing the default code? Should I move all profile modules under sites/all/modules/...? Please help me to follow the best practices. Thank you.

3

Once your features are overridden you have stepped away from the distribution. Sure you could struggle with Features overrides and such but I really think you will end up in a stressful situation.

There might be update hooks in an upcoming release of Commons that reverts all your features, another administrator unknown to the overridden state of things might get terrified and ninja click revert on all overridden features.

I'm not so sure about features overrides also as a long term solution to keep you changes working. Let's say the original feature changes a lot, then your feature override might actually try to override things that no longer is a configuration. I haven't worked that much with the module so I can't say for sure, but it gets messy...

The effort you need to invest in each update of Commons is also depending on what kind of overrides you do. In one installation of Commons I have made a subtheme to what is shipped with Commons. So all changes goes in there and Features is left as is. There might be some work that needs to be done in each update of Commons to keep my sub theme good looking and up to date. But having to double check that all feature overrides etc play along with the update is a lot of work!

Another way is to simply say that Commons is a starting point to your platform. That you take what Commons have, override it all over. Then export what you have into features and say that's your version of Commons. It's a bit of work to get done but it is possible to export all components from a site into new features and then disable the old features. You are now detached :)

Last words :)

It's really hard to override a distribution and still benefit from updates. The distribution itself must sort of be compatible with it. If you feel you still benefit from keeping your overrides up to date in each update of Commons, go for it. If you're not ready to spend time in each update to verify your overrides, don't override or just do simple stuff in the theme or new modules. Or third go bananas and build your own thing but don't expect upgrade paths to play nice.

4

Once your features are overridden, then the configuration is moved from the files to the database (i.e. Drupal no longer looks for the configuration supplied by the feature module and uses your configuration in the DB). This means you can update the files without overriding your changes/additions (Just don't hit the revert button in the Features admin UI). That being said, if you changed/updated a content type, you will no longer be able to take advantage of any changes/updates that were made to the commons distro supplied content type. This is the same for views, contexts, rules, etc. Some devs will use the Features Override module to allow them to store their site specific overrides in a feature. This allows you to store your overrides in files and still leverage any changes/additions from the distro.

  • Thank you Nigel. I know how features work. But my concern is if I update the existing feature which comes with distribution what happens when I need to update the distribution? Won't it revert all my changes? So, is there any way to update feature without touching the one that comes with distribution? – cissharp Jul 30 '13 at 16:03
  • 1
    As I mentioned in my answer, once you override the feature the config is moved from the feature files into the database. So you are ok to update the distro. make sure you backup too. However this way you will not be able to leverage and additions/changes to that specific content type you updated. If you wish to do this then you have to use the features override module to store your changes in files as well. – Nigel Waters Jul 30 '13 at 16:06

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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