Providing an upgrade path for your variables

Unfortunately, providing an upgrade path for variables used in modules for Drupal 6 or Drupal 7 is not as easy as simply fetching the values from the database and storing them into the new configuration system. You need to convert the variables into configuration objects, performing the correct data conversions and saving the values correctly.

Prior to Drupal 8, upgrading between major versions of Drupal was mainly done using hook_update_N(). The developer used this hook to move the required data from the old data structure into the new one, and was responsible for all conversions needed for the data to work in the new version of the site. In 2013, during DrupalCon in Prague, the decision was made to ...

Get Drupal 8 Configuration Management now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.