come progettare e realizzare una distribuzione in drupal 8
TRANSCRIPT
COME PROGETTARE E REALIZZARE UNA
DISTRIBUZIONE IN DRUPAL 8
LUCA LUSSO
SENIOR DRUPAL DEVELOPER @WELLNET
Twitter: @lussolucaLinkedin: it.linkedin.com/pub/luca-lusso/29/3a9/1a2/Drupal.org: www.drupal.org/u/lussolucawww.drupal.org/project/develwww.drupal.org/project/xhprof
AGENDAprerequisiti: Composer e CMIprofili d’installazioneconfigurazionifixturesscript di buildtesting
Drupal core +moduli contrib +tema e moduli custom +fixtures +colla =
distribuzione
COMPOSER
Package manager per PHP
composer.json -> lista dei pacchetti da scaricare (e da
dove scaricarli)
composer.lock -> elenco versioni specifiche per il
progetto
composer update -> controlla aggiornamenti
composer install -> installa le versione indicate in
composer.lock
CMIConfiguration Management InitiativePosso esportare tutta (TUTTA) la configurazione di unsito in filesAPI e best practices che tutti gli sviluppatori di modulidevono rispettareConfigurazioni semplici (nome del sito, chiave diGoogle Analytics)Configurazioni complesse, o entità di configurazione(content type, viste, …)
PROFILI D'INSTALLAZIONE
Quali moduli installare?Quali configurazioni installare?Modifica al workflow di installazionePersonalizzazione dell’installazioneIl Core ne ha due: standard e minimal
PROFILI D'INSTALLAZIONE
ddd.info.ymlddd.installddd.profileconfig/install/*.yml
DDD.INFO.YML
name: DDD
type: profile
description: 'Drupal Dev Days 2016 installation profile.'
version: VERSION
core: 8.x
DDD.INFO.YML
name: DDD
type: profile
description: 'Drupal Dev Days 2016 installation profile.'
version: VERSION
core: 8.x
dependencies:
- node
- block
- ckeditor
[...]
- contact
- captcha
- recaptcha
themes:
- ddd2016
- seven
CREARE CT DI DEFAULT (DRUPAL 7)$types = array( array( 'type' => 'page', 'name' => st('Basic page'), 'base' => 'node_content', 'description' => st("Use <em>basic pages</em> for your static content, such as an 'About us' page." 'custom' => 1, 'modified' => 1, 'locked' => 0, ), ); foreach ($types as $type) { $type = node_type_set_defaults($type); node_type_save($type); node_add_body_field($type); }
standard.install
CREARE CT DI DEFAULT (DRUPAL 8)langcode: en status: true dependencies: { } name: 'Basic page' type: page description: 'Use <em>basic pages</em> for your static content, such as an ''About us'' page.'help: ''new_revision: false preview_mode: 1 display_submitted: false
node.type.page.yml
CREARE CT DI DEFAULT (DRUPAL 8)langcode: en status: true dependencies: module: - node - text id: node.body field_name: bodyentity_type: node type: text_with_summary settings: { } module: text locked: false cardinality: 1 translatable: true indexes: { } persist_with_no_fields: true custom_storage: false
field.storage.node.body.yml
CREARE CT DI DEFAULT (DRUPAL 8)langcode: en status: true dependencies: config: - field.storage.node.body - node.type.page module: - text id: node.page.body field_name: bodyentity_type: node bundle: page label: Body description: '' required: false translatable: true default_value: { } default_value_callback: '' settings: display_summary: true field_type: text_with_summary
field.field.node.page.body.yml
CREARE CT DI DEFAULT (DRUPAL 8)node.type.page.ymlcore.base_field_override.node.page.promote.ymlcore.entity_form_display.node.page.default.ymlcore.entity_view_display.node.page.default.ymlcore.entity_view_display.node.page.teaser.ymlfield.field.node.page.body.ymlfield.storage.node.body.yml
"FEATURES"Nel profilo d'installazioneIn moduli custom specificiconfig_devel
FIXTURESmigratedefault_contentdevel_generate
SCRIPT DI BUILDphing (https://www.phing.info) -> xmlrobo (http://robo.li) -> php
TESTINGunitario -> phpunitfunzionale -> codeceptiondi accettazione (o comportamentale) ->codeception/behat
Hackathon & Drupal school -> domani
Grazie!
Domande?