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

Preface

In professional web development, especially when working in teams of any size, configuration management is one of the most important tasks when it comes to keeping track of configuration changes.

The Wikipedia article for Software Configuration Management states that "In software engineering, software configuration management (SCM) is the task of tracking and controlling changes in the software, which is part of the larger cross-discipline field of configuration management. SCM practices include revision control and the establishment of baselines. If something goes wrong, SCM can determine what was changed and who changed it. If a configuration is working well, SCM can determine how to replicate it across many hosts."

So what is configuration in Drupal terms?

In Drupal, configuration includes topics such as content types, fields, menus, or text formats. Creating or changing a configuration on a live site poses a high risk and makes changes untraceable. Questions such as who made a change, and when and why it was made, cannot be answered.

Up until Drupal 7, Drupal had all configuration stored in the database. By Drupal 7, most professional Drupal developers kept track of their configuration changes by exporting them to code, the most popular option being the Features module, and version-controlling it with a version control system such as Git.

How it works in Drupal 8

When planning for Drupal 8, the so-called Configuration Management Initiative was led by Greg Dunlap in order to make developers' lives easier. Configuration still lives in the database, but can be easily exported to YAML text files. You can now deploy a configuration from one environment to another (between cloned instances of the same site). This capability replaces the need for various contributed modules such as Features, Strongarm, and Context.

This book will teach you everything you need to know about Drupal 8's brand new configuration system. We hope you enjoy it.

What this book covers

Chapter 1, Understanding Configuration Management, will give you a quick overview of Drupal 8's hottest new feature: Configuration Management. You will learn what types of configuration exist, why managing configuration is a good idea, and how to get started with it. We will introduce you to version control and show you some best practices. We will provide a look at the several ways in which configuration was managed in Drupal 7 and then show how Drupal 8 approaches the problem.

Chapter 2, Configuration Management for Administrators, provides an introduction on how to use Configuration Management for users who are not developers, but administrators of a Drupal website who want to make use of the advantages of this new feature. We will show you how to use the Configuration Management interface and how to create a copy of your website, and you will learn how to move a configuration made on one site to another site.

Chapter 3, Drupal 8's Take on Configuration Management, will show you the inner workings of the Configuration Management system in Drupal 8. You will learn about config and schema files, and read about the difference between simple configuration and configuration entities.

Chapter 4, The Configuration Management API, will teach you how to get your hands dirty and learn about the Configuration Management API of Drupal 8. Here, you will dive into the Simple Configuration API and learn how configuration can be overridden. Later, you will take a closer look at how to create custom configuration entity types, and we'll also teach you about the configuration's context system.

Chapter 5, The Anatomy of Schema Files, covers schema files and explains how Drupal uses them for Configuration Management. You will learn about the structure of schema files used by Drupal and write your own schema for custom configuration.

Chapter 6, Adding Configuration Management to Your Module, will teach you how to access configuration objects and how schema files are structured in the previous chapters. (You will surely want to know how to get all this fancy stuff into your shiny new module for Drupal 8). You will learn how to include the default configuration in custom modules, how to define and use your own configuration, and how to create configuration forms.

Chapter 7, Upgrading Your Drupal 7 Variables to the Drupal 8 Configuration, will show you ways to convert your Drupal 7 variables into Drupal 8 Configuration objects and how to provide an upgrade path in your modules.

Chapter 8, Managing Configuration for Multilingual Websites, allows you to build comprehensive multilingual websites in which you can display a site's content in different languages and translate the user interface. While many features were built into Drupal's core in previous versions, building multilingual sites remained a very painful task. In this chapter, we will take a look at how Drupal 7 deals with different languages on a site and how Drupal 8 is trying to fix weaknesses from previous versions.

Chapter 9, Useful Tools and Getting Help, provides a list of links and tools provided by the Drupal community; these will be useful if you reach a point where you need help when dealing with Configuration Management.

What you need for this book

To follow along with this book, you need an installation of Drupal 8, preferably in a local development environment. There's some good documentation about setting up a local development environment at https://www.drupal.org/setting-up-development-environment. Specific system requirements for all Drupal versions are listed at https://www.drupal.org/requirements.

To follow the code examples, you will need a text editor or an IDE. There's a good list of suitable software at https://www.drupal.org/node/147789.

Who this book is for

Drupal Configuration Management is intended for anyone who uses Drupal 8 to build websites, whether they are a hobbyist using Drupal for the first time, or a long-time Drupal site builder, or a professional web developer.

Conventions

In this book, you will find a number of styles of text that distinguish between different kinds of information. Here are some examples of these styles, and an explanation of their meaning.

Code words in text, database table names, folder names, filenames, file extensions, pathnames, dummy URLs, user input, and Twitter handles are shown as follows: "Finally, to run the migrations, we need to execute the Drush command migrate-manifest."

A block of code is set as follows:

# Example for Drupal 7 to Drupal 8 migration
d7_cm_example_settings
d7_cm_example_block
d7_block
d7_filter_format

New terms and important words are shown in bold. Words that you see on the screen, in menus or dialog boxes for example, appear in the text like this: "On this page, you simply select Simple configuration as the configuration type, paste the copied configuration value into the text area, and click on Import."

Note

Warnings or important notes appear in a box like this.

Tip

Tips and tricks appear like this.

Reader feedback

Feedback from our readers is always welcome. Let us know what you think about this book—what you liked or may have disliked. Reader feedback is important for us to develop titles that you really get the most out of.

To send us general feedback, simply send an e-mail to , and mention the book title via the subject of your message.

If there is a topic that you have expertise in and you are interested in either writing or contributing to a book, see our author guide on www.packtpub.com/authors.

Customer support

Now that you are the proud owner of a Packt book, we have a number of things to help you to get the most from your purchase. You can contact the authors at http://drupal-8-configuration-management.undpaul.com if you are facing a problem with any aspect of this book, and they will do their best to address it.

Downloading the example code

You can download the example code files for all Packt books you have purchased from your account at http://www.packtpub.com. If you purchased this book elsewhere, you can visit http://www.packtpub.com/support and register to have the files e-mailed directly to you.

Errata

Although we have taken every care to ensure the accuracy of our content, mistakes do happen. If you find a mistake in one of our books—maybe a mistake in the text or the code—we would be grateful if you would report this to us. By doing so, you can save other readers from frustration and help us improve subsequent versions of this book. If you find any errata, please report them by visiting http://www.packtpub.com/submit-errata, selecting your book, clicking on the errata submission form link, and entering the details of your errata. Once your errata are verified, your submission will be accepted and the errata will be uploaded on our website, or added to any list of existing errata, under the Errata section of that title. Any existing errata can be viewed by selecting your title from http://www.packtpub.com/support.

Piracy

Piracy of copyright material on the Internet is an ongoing problem across all media. At Packt, we take the protection of our copyright and licenses very seriously. If you come across any illegal copies of our works, in any form, on the Internet, please provide us with the location address or website name immediately so that we can pursue a remedy.

Please contact us at with a link to the suspected pirated material.

We appreciate your help in protecting our authors, and our ability to bring you valuable content.

Questions

You can contact us at if you are having a problem with any aspect of the book, and we will do our best to address it.