Book Image

Drupal 8 Configuration Management

Book Image

Drupal 8 Configuration Management

Overview of this book

Table of Contents (16 chapters)
Drupal 8 Configuration Management
Credits
About the Authors
About the Reviewer
www.PacktPub.com
Preface
Index

Upgrading your variables


When upgrading your variables from Drupal 7 to Drupal 8, you first need to identify whether the variables are a simple configuration (for example, the number of nodes displayed to a user) or whether you need to create a more complex configuration object (for example, an image style). Some variables, though, are not meant to be permanent (for example, the time of the last Cron run); additionally, therefore, you will have to decide if it should be a configuration (which is permanent by definition) or a state (which reflects information about the current site's state, but we will come back to this later).

Simple configuration

Let's start with a simple example and a simple variable to convert. Simple variables are, for example, the number of nodes on the front page, the name of your site, or whether your site is in maintenance mode.

We assume that our module built for Drupal 7 uses variables to store settings that a user might configure. So, the module provides a small...