SlideShare ist ein Scribd-Unternehmen logo
1 von 64
Downloaden Sie, um offline zu lesen
Drupal 8: Configuration Management
by Alex Goja
What Is Drupal Config?
A quick quiz01
What is Drupal config ?
Blog post
What is Drupal config ?
Permissions
What is Drupal config ?
Vocabulary
What is Drupal config ?
Taxonomy term
What is Drupal config ?
Field definition
What is Drupal config ?
Menu
What is Drupal config ?
Variable
What is Drupal config ?
Menu item
What is Drupal config ?
User
What is Drupal config ?
Contents of a block
Content An article page, uploaded files
Session
State
Configuration
Logged in status, shopping carts
Last cron run
Everything else
Challenge
• Developer:
• Wants to work on code
• Wants to change the config
• Wants to deploy across environments
• Client:
• Wants to work on content
• Doesn’t want to lose work
Current Situation
02
Current Situation
Drupal 7 Configuration
How do we currently manage configuration in Drupal?
• Features
• Install/Update hooks
• Install Profiles
Current Situation
Features
• Features ‘Overridden’ sadness
• Adding Features support for modules is not easy
• Export and import of certain configurations as modules
Current Situation
Install/Update Hooks
• Create tables

• Set up variables

• Fill in ‘gaps’ in Features modules
Current Situation
Install Profiles
• Combine Features modules and install hooks
• Full site setup out of the box

• Limited Drupal API available

• Doesn’t always work as planned
Drupal 8 CM
03
Drupal 8 CM
Configuration Management
• Move configuration management into core
• Allow storage of configuration in files
• Allow the transfer of configuration between environments
• Create an API to allow custom configurations
• Integrate UUID into core so certain configurations can be given machine names
Usage
04
Drupal 8 CM
Behind The Scenes
• Active configuration is stored in the database
• Clicking Export collates the configuration that each module
defines and combines it with the current active configuration
• Export contains the active configuration in the form 

of YAML files
Drupal 8 CM
Behind The Scenes
• YAML files are used to store the configuration
• Used to store and compare the current configuration
• By default the directories are stored in the location /sites/default/files/
config_<hash>/
Drupal 8 CM
YAML Filenames In Drupal 8
• < module >.< component >.yml
system.settings.yml 

views.settings.yml
• < module >.< component >.< entity >.yml
image.style.medium.yml 

views.view.content.yml
Configuration API
05
Configuration API
Configuration Schema
• Needed to define what your configuration will hold
• Used to define what types of data the configuration will contain
• See more at: https://drupal.org/node/1905070
Configuration API
system.schema.yml
system.site:
type: mapping
label: 'Site information'
mapping:
uuid:
type: string
label: 'Site UUID'
name:
type: label
label: 'Site name'
mail:
type: email
label: 'E-mail address'
slogan:
type: label
label: 'Slogan'
page:
type: mapping
label: 'Pages'
mapping:
403:
type: path
label: 'Default 403 (access denied) page'
404:
type: path
label: 'Default 404 (not found) page'
front:
type: path
label: 'Default front page'
admin_compact_mode:
type: boolean
label: 'Compact mode'
weight_select_max:
type: integer
label: 'Weight element maximum value'
langcode:
type: string
label: 'Default language'
Configuration API
system.schema.yml
Schema name 

- Used to reference this configuration 

- Also shows the configuration filename
“system.site.yml”
system.site:
type: mapping
label: 'Site information'
mapping:
uuid:
type: string
label: 'Site UUID'
name:
type: label
label: 'Site name'
Configuration API
Container data type
- ‘mapping’ is for key value sets
- allows for associative arrays of 

different data types
system.site:
type: mapping
label: 'Site information'
mapping:
uuid:
type: string
label: 'Site UUID'
name:
type: label
label: 'Site name'
system.schema.yml
Configuration API
system.site:
type: mapping
label: 'Site information'
mapping:
uuid:
type: string
label: 'Site UUID'
name:
type: label
label: 'Site name'
Label
- Used as an interface label
system.schema.yml
Configuration API
system.site:
type: mapping
label: 'Site information'
mapping:
uuid:
type: string
label: 'Site UUID'
name:
type: label
label: 'Site name'
system.schema.yml
Start of mapping section
Item key
Item type
Item label
Configuration API
Simple Configuration
• Can be single values or arrays of values
• Used to store global configuration options
• Easy to implement:
• Create schema YAML file in 

< module >/config/install/schema
• Create config YAML file 

< module >/config/install
Configuration API
Getting Configuration
uuid: ''
name: Drupal
mail: ''
slogan: ''
page:
403: ''
404: ''
front: user
admin_compact_mode: false
weight_select_max: 100
langcode: en
$config = Drupal::config('system.site');
$email = $config->get('mail');
$cofig = Drupal::config(‘system.site')
$page403 = $config->get('page.403'); 

Configuration API
Setting Configuration
$config = Drupal::config('system.site'); $config->set(‘mail’,
‘test@example.com’); $config->save();




$config = Drupal::config(‘system.site’)->set('mail', ‘test@example.com’); 

$config->save();







Drupal::config(‘system.site’)->set('mail', ‘test@example.com)- >save();
Configuration API
Clear Configuration
$config = Drupal::config('system.site');
$config->clear('mail')->save(); 



Drupal::config('system.site')->delete();
Configuration API
Configuration Entities
• Used to store custom entity configurations
• More complex and therefore harder to implement
• Used for configurations that have multiple entries
Example: Views, Image cache settings, Contact form
categories
Configuration API
Contact Category Interface
namespace Drupalcontact;



use DrupalCoreConfigEntityConfigEntityInterface; 

/**
* Provides an interface defining a contact category entity.
*/
interface CategoryInterface extends ConfigEntityInterface { 

}
Configuration API
Contact Category Entity
Configuration API
class Category extends ConfigEntityBase implements CategoryInterface {
/**
* The category ID.
*
* @var string
*/
public $id;
/**
* The category label.
*
* @var string
*/
public $label;
/**
* List of recipient e-mail addresses.
*
* @var array
*/
public $recipients = array();
/**
* An auto-reply message to send to the message author.
*
* @var string
*/
public $reply = '';
/**
* Weight of this category (used for sorting).
*
* @var int
*/
public $weight = 0;
Configuration API
contact.category.personal.yml
id: personal

label: 'Personal contact form'

recipients: { }

reply: ''

weight: 0

status: true

uuid: 43155e41-8a58-4264-ab00-be97a0736aa0 langcode: en

dependencies: { }
$contact_category = $this->entityManager()
->getStorage('contact_category')
->load(‘personal');
$contact_category->label();
Configuration API
contact.category.personal.yml
id: personal

label: 'Personal contact form'

recipients: { }

reply: ''

weight: 0

status: true

uuid: 43155e41-8a58-4264-ab00-be97a0736aa0 langcode: en

dependencies: { }
$config = Drupal::config('contact.category.personal')->get();
$label = $config['label'];



$label = Drupal::config(‘contact.category.personal')->get('label');
Configuration API
Drush
Export config from the active configuration to the staging
directory
drush config-export
drush cex
Configuration API
Drush
Import the staging configuration into the active configuration
drush config-import
drush cim
Configuration API
Workflow
• Staging config should become part of your 

codebase
• New configuration changes should be exported 

and integrated into code base
• Configuration in code should then be used to move 

configuration between servers
Configuration API
Configuration API
Drupal 7
06
Configuration API
Drupal 7
• Configuration management has been back ported
• Configuration Management module 

https://drupal.org/project/configuration
Resources
07
Configuration API
Resources
• Creating Drupal 8.x modules 

https://drupal.org/developing/modules/8
• Configuration API in Drupal 8 

https://drupal.org/node/1667894
• Understanding Drupal 8's config entities 

http://www.previousnext.com.au/blog/understanding-drupal-8s-config-entities
• Configuration schema/metadata 

https://drupal.org/node/1905070
• Configuration inspector for Drupal 8 

https://drupal.org/project/config_inspector
Questions ?
Alex Goja
Team Lead
agoja@adyax.com

Weitere ähnliche Inhalte

Was ist angesagt?

Building and Managing Projects with Maven
Building and Managing Projects with MavenBuilding and Managing Projects with Maven
Building and Managing Projects with MavenKhan625
 
SpringBoot with MyBatis, Flyway, QueryDSL
SpringBoot with MyBatis, Flyway, QueryDSLSpringBoot with MyBatis, Flyway, QueryDSL
SpringBoot with MyBatis, Flyway, QueryDSLSunghyouk Bae
 
Building and managing java projects with maven part-III
Building and managing java projects with maven part-IIIBuilding and managing java projects with maven part-III
Building and managing java projects with maven part-IIIprinceirfancivil
 
Training in Android with Maven
Training in Android with MavenTraining in Android with Maven
Training in Android with MavenArcadian Learning
 
Tips and Tricks for LiveWhale Development
Tips and Tricks for LiveWhale DevelopmentTips and Tricks for LiveWhale Development
Tips and Tricks for LiveWhale DevelopmentNaomi Royall
 
Build Amazing Add-ons for Atlassian JIRA and Confluence
Build Amazing Add-ons for Atlassian JIRA and ConfluenceBuild Amazing Add-ons for Atlassian JIRA and Confluence
Build Amazing Add-ons for Atlassian JIRA and ConfluenceK15t
 
8 things to know about theming in drupal 8
8 things to know about theming in drupal 88 things to know about theming in drupal 8
8 things to know about theming in drupal 8Logan Farr
 
Learning to run
Learning to runLearning to run
Learning to rundominion
 
CQ5 QueryBuilder - .adaptTo(Berlin) 2011
CQ5 QueryBuilder - .adaptTo(Berlin) 2011CQ5 QueryBuilder - .adaptTo(Berlin) 2011
CQ5 QueryBuilder - .adaptTo(Berlin) 2011Alexander Klimetschek
 
A first Draft to Java Configuration
A first Draft to Java ConfigurationA first Draft to Java Configuration
A first Draft to Java ConfigurationAnatole Tresch
 
Go Fullstack: JSF for Public Sites (CONFESS 2013)
Go Fullstack: JSF for Public Sites (CONFESS 2013)Go Fullstack: JSF for Public Sites (CONFESS 2013)
Go Fullstack: JSF for Public Sites (CONFESS 2013)Michael Kurz
 
Go Fullstack: JSF for Public Sites (CONFESS 2012)
Go Fullstack: JSF for Public Sites (CONFESS 2012)Go Fullstack: JSF for Public Sites (CONFESS 2012)
Go Fullstack: JSF for Public Sites (CONFESS 2012)Michael Kurz
 
MongoDB & NoSQL 101
 MongoDB & NoSQL 101 MongoDB & NoSQL 101
MongoDB & NoSQL 101Jollen Chen
 
Local storage in Web apps
Local storage in Web appsLocal storage in Web apps
Local storage in Web appsIvano Malavolta
 
Java Web Development with Stripes
Java Web Development with StripesJava Web Development with Stripes
Java Web Development with StripesSamuel Santos
 

Was ist angesagt? (19)

Building and Managing Projects with Maven
Building and Managing Projects with MavenBuilding and Managing Projects with Maven
Building and Managing Projects with Maven
 
SpringBoot with MyBatis, Flyway, QueryDSL
SpringBoot with MyBatis, Flyway, QueryDSLSpringBoot with MyBatis, Flyway, QueryDSL
SpringBoot with MyBatis, Flyway, QueryDSL
 
Building and managing java projects with maven part-III
Building and managing java projects with maven part-IIIBuilding and managing java projects with maven part-III
Building and managing java projects with maven part-III
 
Training in Android with Maven
Training in Android with MavenTraining in Android with Maven
Training in Android with Maven
 
Tips and Tricks for LiveWhale Development
Tips and Tricks for LiveWhale DevelopmentTips and Tricks for LiveWhale Development
Tips and Tricks for LiveWhale Development
 
Build Amazing Add-ons for Atlassian JIRA and Confluence
Build Amazing Add-ons for Atlassian JIRA and ConfluenceBuild Amazing Add-ons for Atlassian JIRA and Confluence
Build Amazing Add-ons for Atlassian JIRA and Confluence
 
Maven II
Maven IIMaven II
Maven II
 
8 things to know about theming in drupal 8
8 things to know about theming in drupal 88 things to know about theming in drupal 8
8 things to know about theming in drupal 8
 
Learning to run
Learning to runLearning to run
Learning to run
 
CQ5 QueryBuilder - .adaptTo(Berlin) 2011
CQ5 QueryBuilder - .adaptTo(Berlin) 2011CQ5 QueryBuilder - .adaptTo(Berlin) 2011
CQ5 QueryBuilder - .adaptTo(Berlin) 2011
 
A first Draft to Java Configuration
A first Draft to Java ConfigurationA first Draft to Java Configuration
A first Draft to Java Configuration
 
Maven
MavenMaven
Maven
 
Go Fullstack: JSF for Public Sites (CONFESS 2013)
Go Fullstack: JSF for Public Sites (CONFESS 2013)Go Fullstack: JSF for Public Sites (CONFESS 2013)
Go Fullstack: JSF for Public Sites (CONFESS 2013)
 
Go Fullstack: JSF for Public Sites (CONFESS 2012)
Go Fullstack: JSF for Public Sites (CONFESS 2012)Go Fullstack: JSF for Public Sites (CONFESS 2012)
Go Fullstack: JSF for Public Sites (CONFESS 2012)
 
MongoDB & NoSQL 101
 MongoDB & NoSQL 101 MongoDB & NoSQL 101
MongoDB & NoSQL 101
 
Oracle XML DB - What's in it for me?
Oracle XML DB - What's in it for me?Oracle XML DB - What's in it for me?
Oracle XML DB - What's in it for me?
 
Local storage in Web apps
Local storage in Web appsLocal storage in Web apps
Local storage in Web apps
 
Java Web Development with Stripes
Java Web Development with StripesJava Web Development with Stripes
Java Web Development with Stripes
 
Spring 3.1
Spring 3.1Spring 3.1
Spring 3.1
 

Andere mochten auch

Drupal Winter Day 2017 Workshop - Personal Blog
Drupal Winter Day 2017 Workshop - Personal BlogDrupal Winter Day 2017 Workshop - Personal Blog
Drupal Winter Day 2017 Workshop - Personal BlogVladimir Melnic
 
Գիտագործնական հավաք կրթահամալիրում
Գիտագործնական հավաք կրթահամալիրումԳիտագործնական հավաք կրթահամալիրում
Գիտագործնական հավաք կրթահամալիրումMarine Amirjanyan
 
DALIA BALČYTYTĖ_englCV
DALIA BALČYTYTĖ_englCVDALIA BALČYTYTĖ_englCV
DALIA BALČYTYTĖ_englCVDalia Balcytyte
 
The IS 11769 Part 1 Usage of Asbestos Cement Products
The IS 11769 Part 1 Usage of Asbestos Cement ProductsThe IS 11769 Part 1 Usage of Asbestos Cement Products
The IS 11769 Part 1 Usage of Asbestos Cement ProductsPGE India - PILOT Gaskets
 

Andere mochten auch (11)

Drupal Winter Day 2017 Workshop - Personal Blog
Drupal Winter Day 2017 Workshop - Personal BlogDrupal Winter Day 2017 Workshop - Personal Blog
Drupal Winter Day 2017 Workshop - Personal Blog
 
Գիտագործնական հավաք կրթահամալիրում
Գիտագործնական հավաք կրթահամալիրումԳիտագործնական հավաք կրթահամալիրում
Գիտագործնական հավաք կրթահամալիրում
 
Aymandcv
AymandcvAymandcv
Aymandcv
 
DALIA BALČYTYTĖ_englCV
DALIA BALČYTYTĖ_englCVDALIA BALČYTYTĖ_englCV
DALIA BALČYTYTĖ_englCV
 
Drupal Winter Day 2017
Drupal Winter Day 2017Drupal Winter Day 2017
Drupal Winter Day 2017
 
Ecosistemul Drupal
Ecosistemul DrupalEcosistemul Drupal
Ecosistemul Drupal
 
The IS 11769 Part 1 Usage of Asbestos Cement Products
The IS 11769 Part 1 Usage of Asbestos Cement ProductsThe IS 11769 Part 1 Usage of Asbestos Cement Products
The IS 11769 Part 1 Usage of Asbestos Cement Products
 
Intake 37 4
Intake 37 4Intake 37 4
Intake 37 4
 
Intake 37 2
Intake 37 2Intake 37 2
Intake 37 2
 
CV_PardeepSingh
CV_PardeepSinghCV_PardeepSingh
CV_PardeepSingh
 
Bp economy-for-99-percent-160117-pt
Bp economy-for-99-percent-160117-ptBp economy-for-99-percent-160117-pt
Bp economy-for-99-percent-160117-pt
 

Ähnlich wie Config management

Top 8 Improvements in Drupal 8
Top 8 Improvements in Drupal 8Top 8 Improvements in Drupal 8
Top 8 Improvements in Drupal 8Angela Byron
 
Валентин Мацвейко та Владислав Мойсеєнко — D8: Migrate Yourself: code->module...
Валентин Мацвейко та Владислав Мойсеєнко — D8: Migrate Yourself: code->module...Валентин Мацвейко та Владислав Мойсеєнко — D8: Migrate Yourself: code->module...
Валентин Мацвейко та Владислав Мойсеєнко — D8: Migrate Yourself: code->module...LEDC 2016
 
Drupal 8 Configuration Management with Features
Drupal 8 Configuration Management with FeaturesDrupal 8 Configuration Management with Features
Drupal 8 Configuration Management with FeaturesNuvole
 
Manage Deployments with Install Profiles and Git
Manage Deployments with Install Profiles and GitManage Deployments with Install Profiles and Git
Manage Deployments with Install Profiles and Gitnhepner
 
Олексій Калініченко — Configuration Management in Drupal8
Олексій Калініченко — Configuration Management in Drupal8Олексій Калініченко — Configuration Management in Drupal8
Олексій Калініченко — Configuration Management in Drupal8LEDC 2016
 
Configuration Management in Drupal 8: A preview (DrupalDays Milano 2014)
Configuration Management in Drupal 8: A preview (DrupalDays Milano 2014)Configuration Management in Drupal 8: A preview (DrupalDays Milano 2014)
Configuration Management in Drupal 8: A preview (DrupalDays Milano 2014)Nuvole
 
Gestione della configurazione in Drupal 8
Gestione della configurazione in Drupal 8Gestione della configurazione in Drupal 8
Gestione della configurazione in Drupal 8Eugenio Minardi
 
Staying Sane with Drupal (A Develper's Survival Guide)
Staying Sane with Drupal (A Develper's Survival Guide)Staying Sane with Drupal (A Develper's Survival Guide)
Staying Sane with Drupal (A Develper's Survival Guide)Oscar Merida
 
Building and Maintaining a Distribution in Drupal 7 with Features
Building and Maintaining a  Distribution in Drupal 7 with FeaturesBuilding and Maintaining a  Distribution in Drupal 7 with Features
Building and Maintaining a Distribution in Drupal 7 with FeaturesNuvole
 
Staging Drupal 8 31 09 1 3
Staging Drupal 8 31 09 1 3Staging Drupal 8 31 09 1 3
Staging Drupal 8 31 09 1 3Drupalcon Paris
 
13th Sep, Drupal 7 advanced training by TCS
13th Sep, Drupal 7 advanced training by TCS 13th Sep, Drupal 7 advanced training by TCS
13th Sep, Drupal 7 advanced training by TCS DrupalMumbai
 
Configuration Management in Drupal 8: A preview (DrupalCamp Alpe Adria 2014)
Configuration Management in Drupal 8: A preview (DrupalCamp Alpe Adria 2014)Configuration Management in Drupal 8: A preview (DrupalCamp Alpe Adria 2014)
Configuration Management in Drupal 8: A preview (DrupalCamp Alpe Adria 2014)Nuvole
 
Drupal Camp Porto - Developing with Drupal: First Steps
Drupal Camp Porto - Developing with Drupal: First StepsDrupal Camp Porto - Developing with Drupal: First Steps
Drupal Camp Porto - Developing with Drupal: First StepsLuís Carneiro
 
A new tool for measuring performance in Drupal 8 - DrupalCamp London
A new tool for measuring performance in Drupal 8 - DrupalCamp LondonA new tool for measuring performance in Drupal 8 - DrupalCamp London
A new tool for measuring performance in Drupal 8 - DrupalCamp LondonLuca Lusso
 
Entities in Drupal 8 - Drupal Tech Talk - Bart Feenstra
Entities in Drupal 8 - Drupal Tech Talk - Bart FeenstraEntities in Drupal 8 - Drupal Tech Talk - Bart Feenstra
Entities in Drupal 8 - Drupal Tech Talk - Bart FeenstraTriquanta
 
The Naked Bundle - Tryout
The Naked Bundle - TryoutThe Naked Bundle - Tryout
The Naked Bundle - TryoutMatthias Noback
 
Apache Cayenne for WO Devs
Apache Cayenne for WO DevsApache Cayenne for WO Devs
Apache Cayenne for WO DevsWO Community
 
Magento 2.0: Prepare yourself for a new way of module development
Magento 2.0: Prepare yourself for a new way of module developmentMagento 2.0: Prepare yourself for a new way of module development
Magento 2.0: Prepare yourself for a new way of module developmentIvan Chepurnyi
 

Ähnlich wie Config management (20)

Top 8 Improvements in Drupal 8
Top 8 Improvements in Drupal 8Top 8 Improvements in Drupal 8
Top 8 Improvements in Drupal 8
 
Валентин Мацвейко та Владислав Мойсеєнко — D8: Migrate Yourself: code->module...
Валентин Мацвейко та Владислав Мойсеєнко — D8: Migrate Yourself: code->module...Валентин Мацвейко та Владислав Мойсеєнко — D8: Migrate Yourself: code->module...
Валентин Мацвейко та Владислав Мойсеєнко — D8: Migrate Yourself: code->module...
 
Drupal 8 Configuration Management with Features
Drupal 8 Configuration Management with FeaturesDrupal 8 Configuration Management with Features
Drupal 8 Configuration Management with Features
 
Manage Deployments with Install Profiles and Git
Manage Deployments with Install Profiles and GitManage Deployments with Install Profiles and Git
Manage Deployments with Install Profiles and Git
 
Олексій Калініченко — Configuration Management in Drupal8
Олексій Калініченко — Configuration Management in Drupal8Олексій Калініченко — Configuration Management in Drupal8
Олексій Калініченко — Configuration Management in Drupal8
 
Configuration Management in Drupal 8: A preview (DrupalDays Milano 2014)
Configuration Management in Drupal 8: A preview (DrupalDays Milano 2014)Configuration Management in Drupal 8: A preview (DrupalDays Milano 2014)
Configuration Management in Drupal 8: A preview (DrupalDays Milano 2014)
 
Into to drupal8
Into to drupal8Into to drupal8
Into to drupal8
 
Gestione della configurazione in Drupal 8
Gestione della configurazione in Drupal 8Gestione della configurazione in Drupal 8
Gestione della configurazione in Drupal 8
 
Staying Sane with Drupal (A Develper's Survival Guide)
Staying Sane with Drupal (A Develper's Survival Guide)Staying Sane with Drupal (A Develper's Survival Guide)
Staying Sane with Drupal (A Develper's Survival Guide)
 
Building and Maintaining a Distribution in Drupal 7 with Features
Building and Maintaining a  Distribution in Drupal 7 with FeaturesBuilding and Maintaining a  Distribution in Drupal 7 with Features
Building and Maintaining a Distribution in Drupal 7 with Features
 
Staging Drupal 8 31 09 1 3
Staging Drupal 8 31 09 1 3Staging Drupal 8 31 09 1 3
Staging Drupal 8 31 09 1 3
 
13th Sep, Drupal 7 advanced training by TCS
13th Sep, Drupal 7 advanced training by TCS 13th Sep, Drupal 7 advanced training by TCS
13th Sep, Drupal 7 advanced training by TCS
 
Configuration Management in Drupal 8: A preview (DrupalCamp Alpe Adria 2014)
Configuration Management in Drupal 8: A preview (DrupalCamp Alpe Adria 2014)Configuration Management in Drupal 8: A preview (DrupalCamp Alpe Adria 2014)
Configuration Management in Drupal 8: A preview (DrupalCamp Alpe Adria 2014)
 
Drupal 8 Configuration Management
Drupal 8 Configuration ManagementDrupal 8 Configuration Management
Drupal 8 Configuration Management
 
Drupal Camp Porto - Developing with Drupal: First Steps
Drupal Camp Porto - Developing with Drupal: First StepsDrupal Camp Porto - Developing with Drupal: First Steps
Drupal Camp Porto - Developing with Drupal: First Steps
 
A new tool for measuring performance in Drupal 8 - DrupalCamp London
A new tool for measuring performance in Drupal 8 - DrupalCamp LondonA new tool for measuring performance in Drupal 8 - DrupalCamp London
A new tool for measuring performance in Drupal 8 - DrupalCamp London
 
Entities in Drupal 8 - Drupal Tech Talk - Bart Feenstra
Entities in Drupal 8 - Drupal Tech Talk - Bart FeenstraEntities in Drupal 8 - Drupal Tech Talk - Bart Feenstra
Entities in Drupal 8 - Drupal Tech Talk - Bart Feenstra
 
The Naked Bundle - Tryout
The Naked Bundle - TryoutThe Naked Bundle - Tryout
The Naked Bundle - Tryout
 
Apache Cayenne for WO Devs
Apache Cayenne for WO DevsApache Cayenne for WO Devs
Apache Cayenne for WO Devs
 
Magento 2.0: Prepare yourself for a new way of module development
Magento 2.0: Prepare yourself for a new way of module developmentMagento 2.0: Prepare yourself for a new way of module development
Magento 2.0: Prepare yourself for a new way of module development
 

Kürzlich hochgeladen

『澳洲文凭』买詹姆士库克大学毕业证书成绩单办理澳洲JCU文凭学位证书
『澳洲文凭』买詹姆士库克大学毕业证书成绩单办理澳洲JCU文凭学位证书『澳洲文凭』买詹姆士库克大学毕业证书成绩单办理澳洲JCU文凭学位证书
『澳洲文凭』买詹姆士库克大学毕业证书成绩单办理澳洲JCU文凭学位证书rnrncn29
 
NSX-T and Service Interfaces presentation
NSX-T and Service Interfaces presentationNSX-T and Service Interfaces presentation
NSX-T and Service Interfaces presentationMarko4394
 
办理(UofR毕业证书)罗切斯特大学毕业证成绩单原版一比一
办理(UofR毕业证书)罗切斯特大学毕业证成绩单原版一比一办理(UofR毕业证书)罗切斯特大学毕业证成绩单原版一比一
办理(UofR毕业证书)罗切斯特大学毕业证成绩单原版一比一z xss
 
Film cover research (1).pptxsdasdasdasdasdasa
Film cover research (1).pptxsdasdasdasdasdasaFilm cover research (1).pptxsdasdasdasdasdasa
Film cover research (1).pptxsdasdasdasdasdasa494f574xmv
 
Call Girls Near The Suryaa Hotel New Delhi 9873777170
Call Girls Near The Suryaa Hotel New Delhi 9873777170Call Girls Near The Suryaa Hotel New Delhi 9873777170
Call Girls Near The Suryaa Hotel New Delhi 9873777170Sonam Pathan
 
PHP-based rendering of TYPO3 Documentation
PHP-based rendering of TYPO3 DocumentationPHP-based rendering of TYPO3 Documentation
PHP-based rendering of TYPO3 DocumentationLinaWolf1
 
办理多伦多大学毕业证成绩单|购买加拿大UTSG文凭证书
办理多伦多大学毕业证成绩单|购买加拿大UTSG文凭证书办理多伦多大学毕业证成绩单|购买加拿大UTSG文凭证书
办理多伦多大学毕业证成绩单|购买加拿大UTSG文凭证书zdzoqco
 
Contact Rya Baby for Call Girls New Delhi
Contact Rya Baby for Call Girls New DelhiContact Rya Baby for Call Girls New Delhi
Contact Rya Baby for Call Girls New Delhimiss dipika
 
SCM Symposium PPT Format Customer loyalty is predi
SCM Symposium PPT Format Customer loyalty is prediSCM Symposium PPT Format Customer loyalty is predi
SCM Symposium PPT Format Customer loyalty is predieusebiomeyer
 
Top 10 Interactive Website Design Trends in 2024.pptx
Top 10 Interactive Website Design Trends in 2024.pptxTop 10 Interactive Website Design Trends in 2024.pptx
Top 10 Interactive Website Design Trends in 2024.pptxDyna Gilbert
 
Font Performance - NYC WebPerf Meetup April '24
Font Performance - NYC WebPerf Meetup April '24Font Performance - NYC WebPerf Meetup April '24
Font Performance - NYC WebPerf Meetup April '24Paul Calvano
 
『澳洲文凭』买拉筹伯大学毕业证书成绩单办理澳洲LTU文凭学位证书
『澳洲文凭』买拉筹伯大学毕业证书成绩单办理澳洲LTU文凭学位证书『澳洲文凭』买拉筹伯大学毕业证书成绩单办理澳洲LTU文凭学位证书
『澳洲文凭』买拉筹伯大学毕业证书成绩单办理澳洲LTU文凭学位证书rnrncn29
 
Call Girls In The Ocean Pearl Retreat Hotel New Delhi 9873777170
Call Girls In The Ocean Pearl Retreat Hotel New Delhi 9873777170Call Girls In The Ocean Pearl Retreat Hotel New Delhi 9873777170
Call Girls In The Ocean Pearl Retreat Hotel New Delhi 9873777170Sonam Pathan
 
Q4-1-Illustrating-Hypothesis-Testing.pptx
Q4-1-Illustrating-Hypothesis-Testing.pptxQ4-1-Illustrating-Hypothesis-Testing.pptx
Q4-1-Illustrating-Hypothesis-Testing.pptxeditsforyah
 
Potsdam FH学位证,波茨坦应用技术大学毕业证书1:1制作
Potsdam FH学位证,波茨坦应用技术大学毕业证书1:1制作Potsdam FH学位证,波茨坦应用技术大学毕业证书1:1制作
Potsdam FH学位证,波茨坦应用技术大学毕业证书1:1制作ys8omjxb
 

Kürzlich hochgeladen (17)

『澳洲文凭』买詹姆士库克大学毕业证书成绩单办理澳洲JCU文凭学位证书
『澳洲文凭』买詹姆士库克大学毕业证书成绩单办理澳洲JCU文凭学位证书『澳洲文凭』买詹姆士库克大学毕业证书成绩单办理澳洲JCU文凭学位证书
『澳洲文凭』买詹姆士库克大学毕业证书成绩单办理澳洲JCU文凭学位证书
 
NSX-T and Service Interfaces presentation
NSX-T and Service Interfaces presentationNSX-T and Service Interfaces presentation
NSX-T and Service Interfaces presentation
 
办理(UofR毕业证书)罗切斯特大学毕业证成绩单原版一比一
办理(UofR毕业证书)罗切斯特大学毕业证成绩单原版一比一办理(UofR毕业证书)罗切斯特大学毕业证成绩单原版一比一
办理(UofR毕业证书)罗切斯特大学毕业证成绩单原版一比一
 
Film cover research (1).pptxsdasdasdasdasdasa
Film cover research (1).pptxsdasdasdasdasdasaFilm cover research (1).pptxsdasdasdasdasdasa
Film cover research (1).pptxsdasdasdasdasdasa
 
Call Girls Near The Suryaa Hotel New Delhi 9873777170
Call Girls Near The Suryaa Hotel New Delhi 9873777170Call Girls Near The Suryaa Hotel New Delhi 9873777170
Call Girls Near The Suryaa Hotel New Delhi 9873777170
 
PHP-based rendering of TYPO3 Documentation
PHP-based rendering of TYPO3 DocumentationPHP-based rendering of TYPO3 Documentation
PHP-based rendering of TYPO3 Documentation
 
办理多伦多大学毕业证成绩单|购买加拿大UTSG文凭证书
办理多伦多大学毕业证成绩单|购买加拿大UTSG文凭证书办理多伦多大学毕业证成绩单|购买加拿大UTSG文凭证书
办理多伦多大学毕业证成绩单|购买加拿大UTSG文凭证书
 
Contact Rya Baby for Call Girls New Delhi
Contact Rya Baby for Call Girls New DelhiContact Rya Baby for Call Girls New Delhi
Contact Rya Baby for Call Girls New Delhi
 
SCM Symposium PPT Format Customer loyalty is predi
SCM Symposium PPT Format Customer loyalty is prediSCM Symposium PPT Format Customer loyalty is predi
SCM Symposium PPT Format Customer loyalty is predi
 
young call girls in Uttam Nagar🔝 9953056974 🔝 Delhi escort Service
young call girls in Uttam Nagar🔝 9953056974 🔝 Delhi escort Serviceyoung call girls in Uttam Nagar🔝 9953056974 🔝 Delhi escort Service
young call girls in Uttam Nagar🔝 9953056974 🔝 Delhi escort Service
 
Hot Sexy call girls in Rk Puram 🔝 9953056974 🔝 Delhi escort Service
Hot Sexy call girls in  Rk Puram 🔝 9953056974 🔝 Delhi escort ServiceHot Sexy call girls in  Rk Puram 🔝 9953056974 🔝 Delhi escort Service
Hot Sexy call girls in Rk Puram 🔝 9953056974 🔝 Delhi escort Service
 
Top 10 Interactive Website Design Trends in 2024.pptx
Top 10 Interactive Website Design Trends in 2024.pptxTop 10 Interactive Website Design Trends in 2024.pptx
Top 10 Interactive Website Design Trends in 2024.pptx
 
Font Performance - NYC WebPerf Meetup April '24
Font Performance - NYC WebPerf Meetup April '24Font Performance - NYC WebPerf Meetup April '24
Font Performance - NYC WebPerf Meetup April '24
 
『澳洲文凭』买拉筹伯大学毕业证书成绩单办理澳洲LTU文凭学位证书
『澳洲文凭』买拉筹伯大学毕业证书成绩单办理澳洲LTU文凭学位证书『澳洲文凭』买拉筹伯大学毕业证书成绩单办理澳洲LTU文凭学位证书
『澳洲文凭』买拉筹伯大学毕业证书成绩单办理澳洲LTU文凭学位证书
 
Call Girls In The Ocean Pearl Retreat Hotel New Delhi 9873777170
Call Girls In The Ocean Pearl Retreat Hotel New Delhi 9873777170Call Girls In The Ocean Pearl Retreat Hotel New Delhi 9873777170
Call Girls In The Ocean Pearl Retreat Hotel New Delhi 9873777170
 
Q4-1-Illustrating-Hypothesis-Testing.pptx
Q4-1-Illustrating-Hypothesis-Testing.pptxQ4-1-Illustrating-Hypothesis-Testing.pptx
Q4-1-Illustrating-Hypothesis-Testing.pptx
 
Potsdam FH学位证,波茨坦应用技术大学毕业证书1:1制作
Potsdam FH学位证,波茨坦应用技术大学毕业证书1:1制作Potsdam FH学位证,波茨坦应用技术大学毕业证书1:1制作
Potsdam FH学位证,波茨坦应用技术大学毕业证书1:1制作
 

Config management

  • 1. Drupal 8: Configuration Management by Alex Goja
  • 2. What Is Drupal Config? A quick quiz01
  • 3. What is Drupal config ? Blog post
  • 4. What is Drupal config ? Permissions
  • 5. What is Drupal config ? Vocabulary
  • 6. What is Drupal config ? Taxonomy term
  • 7. What is Drupal config ? Field definition
  • 8. What is Drupal config ? Menu
  • 9. What is Drupal config ? Variable
  • 10. What is Drupal config ? Menu item
  • 11. What is Drupal config ? User
  • 12. What is Drupal config ? Contents of a block
  • 13. Content An article page, uploaded files Session State Configuration Logged in status, shopping carts Last cron run Everything else
  • 14. Challenge • Developer: • Wants to work on code • Wants to change the config • Wants to deploy across environments • Client: • Wants to work on content • Doesn’t want to lose work
  • 16. Current Situation Drupal 7 Configuration How do we currently manage configuration in Drupal? • Features • Install/Update hooks • Install Profiles
  • 17. Current Situation Features • Features ‘Overridden’ sadness • Adding Features support for modules is not easy • Export and import of certain configurations as modules
  • 18. Current Situation Install/Update Hooks • Create tables
 • Set up variables
 • Fill in ‘gaps’ in Features modules
  • 19. Current Situation Install Profiles • Combine Features modules and install hooks • Full site setup out of the box
 • Limited Drupal API available
 • Doesn’t always work as planned
  • 21. Drupal 8 CM Configuration Management • Move configuration management into core • Allow storage of configuration in files • Allow the transfer of configuration between environments • Create an API to allow custom configurations • Integrate UUID into core so certain configurations can be given machine names
  • 23.
  • 24.
  • 25.
  • 26.
  • 27.
  • 28.
  • 29.
  • 30.
  • 31.
  • 32.
  • 33.
  • 34. Drupal 8 CM Behind The Scenes • Active configuration is stored in the database • Clicking Export collates the configuration that each module defines and combines it with the current active configuration • Export contains the active configuration in the form 
 of YAML files
  • 35. Drupal 8 CM Behind The Scenes • YAML files are used to store the configuration • Used to store and compare the current configuration • By default the directories are stored in the location /sites/default/files/ config_<hash>/
  • 36. Drupal 8 CM YAML Filenames In Drupal 8 • < module >.< component >.yml system.settings.yml 
 views.settings.yml • < module >.< component >.< entity >.yml image.style.medium.yml 
 views.view.content.yml
  • 38. Configuration API Configuration Schema • Needed to define what your configuration will hold • Used to define what types of data the configuration will contain • See more at: https://drupal.org/node/1905070
  • 39. Configuration API system.schema.yml system.site: type: mapping label: 'Site information' mapping: uuid: type: string label: 'Site UUID' name: type: label label: 'Site name' mail: type: email label: 'E-mail address' slogan: type: label label: 'Slogan' page: type: mapping label: 'Pages' mapping: 403: type: path label: 'Default 403 (access denied) page' 404: type: path label: 'Default 404 (not found) page' front: type: path label: 'Default front page' admin_compact_mode: type: boolean label: 'Compact mode' weight_select_max: type: integer label: 'Weight element maximum value' langcode: type: string label: 'Default language'
  • 40. Configuration API system.schema.yml Schema name 
 - Used to reference this configuration 
 - Also shows the configuration filename “system.site.yml” system.site: type: mapping label: 'Site information' mapping: uuid: type: string label: 'Site UUID' name: type: label label: 'Site name'
  • 41. Configuration API Container data type - ‘mapping’ is for key value sets - allows for associative arrays of 
 different data types system.site: type: mapping label: 'Site information' mapping: uuid: type: string label: 'Site UUID' name: type: label label: 'Site name' system.schema.yml
  • 42. Configuration API system.site: type: mapping label: 'Site information' mapping: uuid: type: string label: 'Site UUID' name: type: label label: 'Site name' Label - Used as an interface label system.schema.yml
  • 43. Configuration API system.site: type: mapping label: 'Site information' mapping: uuid: type: string label: 'Site UUID' name: type: label label: 'Site name' system.schema.yml Start of mapping section Item key Item type Item label
  • 44. Configuration API Simple Configuration • Can be single values or arrays of values • Used to store global configuration options • Easy to implement: • Create schema YAML file in 
 < module >/config/install/schema • Create config YAML file 
 < module >/config/install
  • 45. Configuration API Getting Configuration uuid: '' name: Drupal mail: '' slogan: '' page: 403: '' 404: '' front: user admin_compact_mode: false weight_select_max: 100 langcode: en $config = Drupal::config('system.site'); $email = $config->get('mail'); $cofig = Drupal::config(‘system.site') $page403 = $config->get('page.403'); 

  • 46. Configuration API Setting Configuration $config = Drupal::config('system.site'); $config->set(‘mail’, ‘test@example.com’); $config->save(); 
 
 $config = Drupal::config(‘system.site’)->set('mail', ‘test@example.com’); 
 $config->save();
 
 
 
 Drupal::config(‘system.site’)->set('mail', ‘test@example.com)- >save();
  • 47. Configuration API Clear Configuration $config = Drupal::config('system.site'); $config->clear('mail')->save(); 
 
 Drupal::config('system.site')->delete();
  • 48. Configuration API Configuration Entities • Used to store custom entity configurations • More complex and therefore harder to implement • Used for configurations that have multiple entries Example: Views, Image cache settings, Contact form categories
  • 49. Configuration API Contact Category Interface namespace Drupalcontact;
 
 use DrupalCoreConfigEntityConfigEntityInterface; 
 /** * Provides an interface defining a contact category entity. */ interface CategoryInterface extends ConfigEntityInterface { 
 }
  • 51. Configuration API class Category extends ConfigEntityBase implements CategoryInterface { /** * The category ID. * * @var string */ public $id; /** * The category label. * * @var string */ public $label; /** * List of recipient e-mail addresses. * * @var array */ public $recipients = array(); /** * An auto-reply message to send to the message author. * * @var string */ public $reply = ''; /** * Weight of this category (used for sorting). * * @var int */ public $weight = 0;
  • 52. Configuration API contact.category.personal.yml id: personal
 label: 'Personal contact form'
 recipients: { }
 reply: ''
 weight: 0
 status: true
 uuid: 43155e41-8a58-4264-ab00-be97a0736aa0 langcode: en
 dependencies: { } $contact_category = $this->entityManager() ->getStorage('contact_category') ->load(‘personal'); $contact_category->label();
  • 53. Configuration API contact.category.personal.yml id: personal
 label: 'Personal contact form'
 recipients: { }
 reply: ''
 weight: 0
 status: true
 uuid: 43155e41-8a58-4264-ab00-be97a0736aa0 langcode: en
 dependencies: { } $config = Drupal::config('contact.category.personal')->get(); $label = $config['label'];
 
 $label = Drupal::config(‘contact.category.personal')->get('label');
  • 54. Configuration API Drush Export config from the active configuration to the staging directory drush config-export drush cex
  • 55. Configuration API Drush Import the staging configuration into the active configuration drush config-import drush cim
  • 56. Configuration API Workflow • Staging config should become part of your 
 codebase • New configuration changes should be exported 
 and integrated into code base • Configuration in code should then be used to move 
 configuration between servers
  • 60. Configuration API Drupal 7 • Configuration management has been back ported • Configuration Management module 
 https://drupal.org/project/configuration
  • 62. Configuration API Resources • Creating Drupal 8.x modules 
 https://drupal.org/developing/modules/8 • Configuration API in Drupal 8 
 https://drupal.org/node/1667894 • Understanding Drupal 8's config entities 
 http://www.previousnext.com.au/blog/understanding-drupal-8s-config-entities • Configuration schema/metadata 
 https://drupal.org/node/1905070 • Configuration inspector for Drupal 8 
 https://drupal.org/project/config_inspector