Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Save more on your purchases! discount-offer-chevron-icon
Savings automatically calculated. No voucher code required.
Arrow left icon
All Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Newsletter Hub
Free Learning
Arrow right icon
timer SALE ENDS IN
0 Days
:
00 Hours
:
00 Minutes
:
00 Seconds
Arrow up icon
GO TO TOP
Drupal 8 Configuration Management

You're reading from   Drupal 8 Configuration Management

Arrow left icon
Product type Paperback
Published in Mar 2015
Publisher
ISBN-13 9781783985203
Length 148 pages
Edition 1st Edition
Languages
Tools
Concepts
Arrow right icon
Authors (2):
Arrow left icon
 Borchert Borchert
Author Profile Icon Borchert
Borchert
 Schirwinski Schirwinski
Author Profile Icon Schirwinski
Schirwinski
Arrow right icon
View More author details
Toc

Table of Contents (16) Chapters Close

Drupal 8 Configuration Management
Credits
About the Authors
About the Reviewer
www.PacktPub.com
Preface
1. Understanding Configuration Management FREE CHAPTER 2. Configuration Management for Administrators 3. Drupal 8's Take on Configuration Management 4. The Configuration Management API 5. The Anatomy of Schema Files 6. Adding Configuration Management to Your Module 7. Upgrading Your Drupal 7 Variables to the Drupal 8 Configuration 8. Managing Configuration for Multilingual Websites 9. Useful Tools and Getting Help Index

PHP API


Defining a schema for your configuration is not only for Drupal's internals, it may also help you while writing a custom module. For example, you might like to get the data type of a configuration object (say, for validation purposes or to print out information about the type).

In addition to the already known \Drupal::config($name) to load a single configuration object, there is \Drupal::service('config.typed'). Using this function, you can access the definition of a configuration object's data structure.

To load the type definition of, for example, system.maintenance, we could use the following code:

<?php
$definition = \Drupal::service('config.typed')->getDefinition('system.maintenance');
?>

This would result in an array that contains the following structure:

<?php
$definition = array(
  'label' => 'Maintenance mode',
  'type' => 'system.maintenance',
  'class' => '\Drupal\Core\Config\Schema\Mapping',
  'definition_class' => '\Drupal\Core\TypedData\MapDataDefinition...
lock icon The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $15.99/month. Cancel anytime
Visually different images