I am a pretty seasoned Drupal developer and I maintain a distribution which is made up of a base theme, contrib modules, custom 'system' modules and a profile to glue it all together. My ambition is to develop a full suite of 'standard' modules like 'news' and 'events' which can be included as part of a site roll out (i.e. in the makefile). I already use features heavily to export, well, exportables, and I always ensure that nothing lives purely in the database unless appropriate.

My problem is when it comes to features and 'standard' modules. The idea is that standard modules can be used across many sites and generally cover 90% of use cases. There are of course times when a particular client has different needs, and I still want to use the standard module for sake of maintainability, but have some bespoke functionality present.

So here is the predicament. Let's say you have a 'news' module which exports:

content type [news_article] fields [news_article_category],[news_article_image] vocabulary [news_article_categories] image formatter [news_article_image_formatter] panelizer stuff [node:news_article:default],[node:page:news_article_list]

With features it's pretty trivial to export this all. But, as soon as, let's say, the client wants the news article display page (which is panelized) to be displayed differently, and you change it accordingly, you end up with a overridden feature. The solution? Well, features_overrides module would appear to solve this problem, but it just doesn't seem to work. The other solution is to not export these things as features and build them bespoke each time.

Now, if I could install these features in hook_install or similar, this would mean the basics would be available as standard, and then could be overridden on a bespoke site and featured out to keep the changes for that site in its relevant repository.

However, it's insanely verbose - to programatically write out what you can accomplish in 15 minutes in the UI (this is why I love/hate Drupal). Is there a way to export all config, like in features, but exported 'code' essentially can be placed in to an install hook, which installs the content type, fields, vocabulary, panelizer configs and all related settings on module install (think variables too, i.e. strongarm).

Note: I understand how to create a content type, and some simple fields in an install file. But the rest, which is easy with features would be nightmarish in a manual process.

Thanks in advance.

  • Check out Configuration Management. Very easy to extend and it's modelled (at least to some degree) on the D8 config API – Clive Nov 11 '14 at 16:56
  • Thank you - this does look pretty interesting, I will 'give it a go' and see if I can get it to play nicely with my environment. For what it's worth, I also found Features Tools which might help in my situation to 'unlink' certain parts of features on a site that are to be overridden, but I suspect this might not work as I imagine it to. – Niechea Nov 11 '14 at 17:41
  • It's hardly a ready to use solution, but take a look at Views query substitutions. It was meant to allow an exported View to include "variables" that can be replaced at "run-time" so to speak. I never used it much, but perhaps the idea can be extended. – Letharion Nov 11 '14 at 17:55
  • I rarely ever use Views, so unfortunately this wouldn't help so much. I tend to exclusively use the DB API to produce content lists etc, no matter how complex the data structure (this means I can override queries however I see fit for any given situation or site). – Niechea Nov 12 '14 at 9:05
  • I just read this article which sort of demonstrates how even these big Drupal workshops struggle with presentation being exported with features... they offer a solution (abstract presentation into separate features, which sort of works but a bit of a shame to have to completely rewrite the presentation layer each time you want to make just a small change). – Niechea Nov 12 '14 at 10:03

Your Answer

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

Browse other questions tagged or ask your own question.