Features vs. CMI in Drupal 8

The Features module is still necessary

Jaap-Jan Koster attended the track of Maike Potter.

A part of our development team is visiting Drupalcon 2015 in Barcelona. There are many session tracks about different subjects during the five day event. Our developers share their experience on our blog. First, Jaap-Jan Koster, Head of Development at GoalGorilla. He attended the track of Mike Potter on 22 September. Mike is Product Architect at Phase2 and responsible for the Open Atrium 2 distribution for building enterprise-level social collaboration sites in Drupal. In this article, you read more about his track: Features for Drupal 8.

 

Mike Potter is primary maintainer of the Features and Features Override modules. The Features module has played an important role in deploying site configuration for Drupal 7. The module enables the capture and management of features in Drupal. A feature is a collection of Drupal entities which taken together satisfy a certain use-case. The Features model provides a UI and API for taking different site building components from modules with exportables, and bundling them together in a single feature module. A feature module is like any other Drupal module, except that it declares its components (e.g. views, contexts, CCK fields, etc.) in its .info file, so it can be checked, updated, or reverted programmatically. But... now that Drupal 8 has configuration management (CMI) built into core, what's the role of the Features module in Drupal 8? Why is Features still necessary in Drupal 8?

Back to the original mission

Drupal 7 core didn’t have a system to manage configuration, and because the Features module could export and import configuration data as code modules, Features was often used for configuration management and deployment. But the module wasn’t really suitable for this function, because:

  • No consistency in the structure of the exported config
  • The exported code wasn't good for data
  • Overrides and revert modifications of content managers

Fortunately, Drupal 8 has configuration management which does all of this. Now you’re thinking: ‘we don’t need Features anymore.’ But that’s wrong! CMI isn’t suitable to export the bundling functionality to other websites, clients or projects. And that’s why you still need Features. In Drupal 8, Features will return to it's original mission of bundling functionalities (like a blog, a pressroom or an image gallery) rather than just managing configuration. It allows you to pick and choose what configuration data you want to add to your custom module in a simplified process. And that’s awesome for developers. It allows them to import modifications from the module into your site without needing to first uninstall the module. And that’s making it much easier to update the configuration stored in the module during development.

Key features of Features D8

Beside that, there are some issues with CMI. First, adding config to a module is a manual process (copy/paste of yml data). Second, modules provide only initial config files. If you wanna change the config files, you need to do that through writing update hooks. And last, if you uninstall a module, it doesn’t remove all the config. And Drupal 8 core can’t enable a module if config already exists.

The key features of Features for Drupal 8 are:

  • Import, export and detect changes
  • Assignment plugins for auto-packaging
  • Bundles
  • Drush 7 support
  • Modular UI
  • Not needed on Production

In short, you still need Features to bundle functionalities and to easily import changes during development!

 

For more details, watch Mike’s entire track in the video below.

 

 

To summarise: the Features module is still very valuable in D8. The module is now a “developer module” which aims to help Drupal developers in their day-to-day work. Delivered work will be better structured with the help of the Features module. The current GoalGorilla.com website is already built in Drupal 8 before the Features module was released. One of the things we noticed that it was hard to bundle configurations, especially when you are working with a bigger development team at the same time. We are looking forward to install and test this module on GoalGorilla.com as soon as possible.

 

Beheerder
GoalGorilla

Bekijk ook onze andere nieuwsartikelen

Klik voor onze award winnende klanten