Introductie Drupal 
INTEC Brussel – 30 sept 2014
Agenda
p. 3 
Overzicht 
 Over Fedict 
 LAMP stack 
 Drupal algemeen 
 Overzicht, community 
 Drupal 6 / 7 
 Opbouw, modules en distributies, talen 
 Drupal 8, vooruitblik 
 Sites en modules testen
Over Fedict
Federale Overheidsdienst voor ICT 
 E-Gov componenten en diensten 
 Netwerk tussen gebouwen / internet (FedMAN) 
 Gegevensuitwisseling (Federal Service Bus) 
 Authenticatie (Federal Authentication Service) 
 Website platform en service (Drupal OpenFed) 
 Elektronische identiteitskaart 
 http://www.fedict.belgium.be/nl/service_catalogue 
 ICT medewerkers via Fedict Select 
p. 5 
 http://www.fedictselect.be
LAMP stack
Linux, Apache, MySQL, PHP 
p. 7 
MySQL 
PHP 
Linux 
Apache
 Open source besturingssysteem 
 Begonnen als hobbyproject in 1991 
 Alternatief voor dure Unix systemen 
 Van kleine tot grote systemen 
 Modem / routers (BeBox) 
 Smartphones / tablets (Android) 
 PCs 
 Supercomputers 
p. 8 
Linux 
Larry Ewing, http://commons.wikimedia.org/wiki/File:Tux-shaded.svg
p. 9 
Apache HTTPd 
 Open source webserver 
 Serie patches NCSA in 1995 
 Draait op Linux, Windows, BSD, OS X, ... 
 Ooit door 70% van alle sites gebruikt (nu 30%) 
 Erg veelzijdige server 
 Allerlei modules: proxy, beveiliging, scripts, logging, … 
 Deel van Apache Software Foundation
MySQL 
 Open source relationele database 
 Ontstaan in 1995 
 Draait op Linux, Windows, BSD … 
 C, Java, .Net, PHP, Python, Ruby … connectors 
 Firma gekocht door Sun (nu Oracle) in 2008 
 Product blijft open source... 
 … daarnaast ontstaan varianten zoals MariaDB, Drizzle 
p. 10 
 WebScaleSQL 
 Facebook, Twitter, LinkedIn (Google)
 Script taal voor webpagina's 
 Begonnen in 1995 (“Personal Home Page”) 
 Draait op Linux, Windows, BSD … 
 Joomla, WordPress, phpMyAdmin, phpBB, ... 
 Nu meer aandacht voor performantie 
 APC, Zend Opcache / Optimizer+ … opcode cache 
 Facebook HipHop / HHVM compiler 
p. 11 
PHP
Drupal: overzicht
Drupal site: voorbeeld 
p. 13
Drupal 
 (Web) Content Management Systeem 
p. 14 
 Ontstaan in 2001 
 Open source (GPL) 
 1000-en modules 
 Workflow, integratie, beheer, e-shop, ... 
 Meestal op LAMP 
 Draait soms ook op BSD, MacOS X, MS-Windows 
 … op nginx, IIS webserver 
 … Postgres, MS SQL Server / Azure database
Sterke punten 
 Actieve gebruikersgroepen 
 Geen licentiekosten 
 Veel documentatie 
p. 15 
 Handboeken, online 
 Zeer veel mogelijkheden 
 Uitbreiden functionaliteit, wijzigen lay-out 
 Zeer populair 
 Veel kleine en grotere Drupal-bedrijven
 100-en overheidssites in België 
 ZuinigMetStraling, OFO-IFA, HRJ, Civiele Veiligheid ... 
 Overheidssites in het buitenland 
 WhiteHouse.gov, maar ook in Australië, Frankrijk, ... 
 StuBru, Vier, VTM, Kinepolis 
 Amnesty Int, UNICEF.be, Greenpeace UK 
 Carrefour, Essent, Tesla Motors 
p. 16 
Zeer populair
 Standaard zoekmotor is beperkt 
 Geen autocomplete, wildcard, search in documenten 
 => Oplossing is Apache Solr / Lucene + Tika (Java) 
 Meerdere talen op 1 site is soms lastig 
 Extra modules en configuratie nodig 
 => Eindelijk “out-of-the-box” in Drupal 8 
 Mix van content- / configuratiebeheer 
 Zeer moeilijk om enkel content / config te kopiëren 
 => Drupal 8 
p. 17 
Zwakke punten
 Elke major release heeft andere API 
 Modules moeten vaak opnieuw ontwikkeld worden 
 Niet bedoeld voor documentbeheer 
 Wel integratie met bijvoorbeeld Alfresco mogelijk 
p. 18 
Zwakke punten (2)
Voorbeelden integraties 
p. 19 
 Documentbeheer 
 Alfresco (via CMIS module) 
 Multimedia 
 Youtube, Vimeo (Media module) 
 Sociale Media 
 Twitter, Facebook (AddThis, ShareThis...) 
 Statistieken 
 GoogleAnalytics
Drupal en Solr search 
File (extractie PDF,...) 
p. 20 
Solr server 
(Java) 
Drupal 
(PHP) 
Apache Solr 
Modules 
Tika 
Lucene 
(index) 
Content
p. 21 
Snel van start 
 Website 
 http://drupal.org 
 Online site bouwen (gratis maar wat beperkt) 
 http://simplytest.me/ 
 http://www.drupalgardens.com/ 
 http://www.acquia.com/acquia-cloud-free
Snel van start (eigen machine) 
 Oracle VirtualBox (desktop) 
 Open source virtualisatie 
 MacOS X, Linux, MS-Windows 
 https://www.virtualbox.org/ 
p. 22 
 Virtuele machines 
 http://www.turnkeylinux.org/ 
 LAMP stack voor MacOS / Windows / Linux 
 Goed voor development, niet voor productie 
 https://www.apachefriends.org/index.html
© Fedict 2014. All rights reserved 
Drupal: community
Beheer op drupal.org, voordelen 
 “Project” voor themes, modules, ... 
 Referentie (klanten / werkgevers) 
 Gratis + bespaart werk 
 Automatisch aanmaken downloads 
 Bij correct gebruik: link bug ticket naar fix in code 
 Automatische tests mogelijk 
 Statistieken aantal sites die module gebruiken 
 Enkel sites die “Update” module hebben geactiveerd 
 Enkel totalen, geen gedetailleerde lijst van sites 
p. 24
Projectpagina: voorbeeld 
p. 25
Projectpagina: functies 
p. 26 
 Algemene informatie 
 Beschrijving, lijst ontwikkelaars, downloads 
 Statistieken, laatste activiteit 
 Eventueel link naar gelijkaardige projecten, documentatie 
 Issue tracker 
 Bugs, vragen, aanvraag nieuwe functies 
 Iedereen mag commentaar geven / patches sturen
 Ontwikkeld door Linus Torvalds 
 Oorspronkelijk om versies Linux kernel te beheren 
 Beschikbaar voor Linux, Windows, MacOS X... 
 “Wie” heeft “wat” “wanneer” gewijzigd 
 Terugkeren naar vorige versie is mogelijk 
 Commentaar toevoegen “waarom” 
 Link met projectpagina op Drupal.org 
 Git “Issue #12345 ...” wordt gelinkt aan ticket 12345 
p. 27 
Git versiebeheer
Projectpagina: git commits 
p. 28
Zelf project maken drupal.org 
 Iedereen kan sandbox project aanmaken 
 Projectpagina, git, … 
 (Nog) geen unieke projectnaam (enkel nummer) 
 Full projects door “goedgekeurde” developers 
 Unieke naam op drupal.org 
 “Promotie” sandbox => full is mogelijk 
 Mogelijkheid om anderen toegang te geven 
 Beheren tickets, beheren projectpagina, ... 
p. 29
Eenmalige developer / code review 
 Niet vereist om patches op te sturen 
 Voor wie zelf modules... op d.o. wil beheren 
 Doel: verhogen kwaliteit modules 
 Eenmalige review door andere drupal.org developers 
 Nakijken correct gebruik Drupal API, documentatie... 
 Kan helaas weken / maanden duren (vrijwilligers) 
 Nadien onbeperkt aanmaken projecten 
p. 30
Marketplace 
 Lijst van Drupal-bedrijven 
 Training, hosting, ontwikkeling, … 
 Gekoppeld aan activiteiten / projecten op d.o. 
p. 31 
 Lijst van Drupal-boeken
© Fedict 2014. All rights reserved 
Drupal 6 / 7: opbouw
Module Module Profile Theme Library 
Module Module Theme 
p. 33 
Distributie 
Van module tot distributie 
Module Module Theme 
Core 
Module Module 
Library
p. 34 
Themes 
 Layout 
 2 000+ gratis themes 
 Mix van HTML / CSS / Javascript en/of PHP 
 Subthemes mogelijk 
 Gebaseerd op / variant van bestaand theme 
 Sneller te ontwikkelen, vaak al “mobile”, “responsive” 
 Populaire “base themes”: Zen, Omega
Modules 
 Core modules (standaard in Drupal) 
p. 35 
 Blog, Page, ... 
 Contrib modules 
 25 000+ gratis modules 
 Wisselende kwaliteit en ondersteuning 
 Verbetering functies / extra mogelijkheden 
 Integratie Google / Facebook / Twitter … diensten 
 Workflow, eCommerce, beheer content / gebruikers, ...
Libraries 
 Geschreven in PHP en/of Javascript 
 Visuele effecten / opmaak 
p. 36 
 Jquery Cycle, SuperFish, ... 
 Integratie met andere diensten 
 OpenLayers, MailChimp, ... 
 Online HTML editor 
 Zit niet standaard in D6 / D7 (wel in D8) 
 CKEditor, TinyMCE
(Installation) profiles en distributies 
p. 37 
 Installation profiles 
 Keuze (enkel) bij installatie 
 Verzameling modules, themes, libraries 
 Gescripte configuratie van deze modules 
 800 distributies 
 Core + installation profile(s), modules, themes … 
 Commerce Kickstart, OpenFed, Acquia Commons, ...
© Fedict 2014. All rights reserved 
Drupal 6 / 7: modules
Goeie informatici zijn lui 
http://commons.wikimedia.org/wiki/File:Lazzaro1.jpg 
p. 39
Zelf een module bouwen ? 
p. 40 
Bestaat 
er al een 
module ? 
Actieve 
ontwikkeling 
(Co-) 
maintainer 
worden ? 
Patch 
mogelijk ? 
Eigen module 
J 
N 
J 
N N 
N 
J 
Patch 
J
Bestanden van een module 
p. 41 
 <module>.info 
 Naam, versie van module, afhankelijkheden 
 <module>.install 
 Code installatie / upgrade / verwijderen module 
 <module>.module / <module>.inc 
 Eigenlijke module en include files 
 <module>.test 
 SimpleTest bestanden
p. 42 
.info voorbeeld 
name = Date 
description = Makes date/time fields available. 
project = "date" 
version = "7.x-2.8" 
package = Date/Time 
core = 7.x 
Php = 5.2 
dependencies[] = date_api 
files[] = date.migrate.inc 
files[] = tests/date_api.test 
files[] = tests/date.test
Drupal API 
 Lijst van Drupal functies, constanten 
 Form API / builder 
p. 43 
 Formulieren 
 Hooks 
 Installatie / verwijderen module 
 Toevoegen / verwijderen content / gebruikers / menu's 
 Menu's, fields, ...
Menu hook voorbeeld 
p. 44 
/** 
* Implements hook_menu(). 
*/ 
function devel_menu() { 
... 
$items['devel/settings'] = array( 
'title' => 'Devel settings', 
'description' => 'Helper functions, pages', 
'page callback' => 'drupal_get_form', 
'page arguments' => array('devel_admin_settings'), 
'access arguments' => array('administer site configuration'), 
'file' => 'devel.admin.inc', 
'menu_name' => 'devel', 
); 
... 
return system_settings_form($form); 
}
© Fedict 2014. All rights reserved 
Drupal 6 / 7: distributies
Wanneer een distributie bouwen ? 
 Veel sites op zelfde platform 
 Voordelen: 
 Sneller beginnen met sites te ontwikkelen 
 Makkelijker te onderhouden (bij strikt beheer) 
p. 46 
 Nadelen: 
 Beetje configuratiewerk 
 Minder flexibel
Drush tool 
 Command line (php) tools 
 Modules (des)activeren, backups, … 
 Uitbreidbaar met eigen commando's 
p. 47 
 Drush make 
 Bundelen core, modules, patches, themes... 
 Bij voorkeur exacte versienummers gebruiken
p. 48 
Makefile voorbeeld 
libraries[colorbox][download][type] = "get" 
libraries[colorbox][download][url] = 
"https://github.com/jackmoore/colorbox/archive/1.5.13.zip" 
libraries[colorbox][directory_name] = "colorbox" 
libraries[colorbox][type] = "library" 
projects[admin_language][download][type] = git 
projects[admin_language][download][branch] = "7.x-1.x" 
projects[admin_language][download][revision] = 6f0a6e5 
projects[admin_language][subdir] = contrib 
projects[i18n][version] = "1.11" 
projects[i18n][subdir] = contrib 
projects[i18n][patch][2250501] = "http://drupal.org/files/issues/i18n-node_ 
edit-2250501-8.patch"
Licenties 
 Open source =/= zonder licentiebepalingen 
 Beperkingen / verplichtingen 
 Verschillende licenties niet altijd compatibel 
p. 49 
 Drupal: GPL v2 of later 
 Code beschikbaar stellen aan gebruiker 
 Gebruikers mogen code doorgeven 
 Drupal: whitelist compatibele componenten 
 Alle drupal.org modules / themes … 
 Enkele externe modules / libraries ...
Distributie op drupal.org 
 Projectpagina etc zoals bij module 
 Gecontroleerde drush make file 
 Enkel “full” modules / themes van drupal.org 
 Beperkte lijst toegestane libraries 
 https://drupal.org/project/drupalorg_whitelist 
p. 50
© Fedict 2014. All rights reserved 
Drupal 6 / 7: meertaligheid
p. 52 
Meertaligheid 
http://commons.wikimedia.org/wiki/File:Br%C3%BCssel_%28Ortstafel%29.jpg
 Labels, foutboodschappen ... 
 Standaard mails, site slogan, ... 
 Navigatie / menu's 
 Drop-down lijsten / taxonomies 
 Inhoud pagina's 
p. 53 
Vertalingen
 (Veel) extra modules nodig 
 i18n, i18nviews, entity translation 
 Vertaling niet altijd 1-op-1 
 Vb: NL + FR site met beperkte vertaling naar EN + DE 
 Wat met menu's ? Pagina's die enkel in 1 taal bestaan ? 
 Vertaling gebeurt op verschillende plaatsen 
 Ook verschillende rechten nodig 
p. 54 
Aandachtspunten
Vertaling van inhoud 
p. 55 
 Drupal 6 
 Vertaling per “node”, elke vertaalde node een andere ID 
 => wat met bijvoorbeeld “likes” (vertaalde of alle nodes ?) 
 “Synchroon” houden auteur, datum … ? (i18nsync) 
 Drupal 7 
 Vertaling per node, zoals in D6 
 Of per veld (entity translation) 
 => zelfde ID, maar werkt niet altijd met alle modules
© Fedict 2014. All rights reserved 
Sites en modules testen
Simpletest module 
 Standaard in D7 (“Testing”) module 
p. 57 
 Aparte module in D6 
 Testen van functies tijdens ontwikkeling 
 Niet verplicht, wel sterk aan te raden 
 Testen kunnen ook automatisch draaien op d.o.
Simpletest voorbeeld 
p. 58 
<?php 
public function setUp() { 
parent::setUp('simpletest_demo'); 
$this->privileged_user = $this->drupalCreateUser( 
array('create simpletest_demo', 'edit own simpletest_demo')); 
$this->drupalLogin($this->privileged_user); 
} 
public function testSimpleTestDemoCreate() { 
$edit = array(); 
$edit['title'] = 'SimpleDemo'; 
$edit['body'] = $this->randomName(80); 
$this->drupalPost('node/add/simpletest-demo', $edit, t('Save')); 
$this->assertText(t('SimpleDemo has been created.')); 
} 
?>
p. 59 
Simpletest rapport
Hulpmiddelen 
 Automatische code review 
 http://pareview.sh 
 Documentatie, correct gebruik API, naamgeving... 
 Tips ivm veiligheid en performantie 
 Eigen te schrijven unit tests (SimpleTest) 
 https://drupal.org/simpletest 
p. 60 
 Development module 
 https://drupal.org/project/devel
 Automatiseren testen via browser 
 Aansturen IE, Firefox, Chrome, … via script / code 
 Java, Python, C#, Ruby, (PHP) 
 http://www.seleniumhq.org 
 Nabootsen wat gebruiker doet / ziet 
 Klikken, uploaden files, invullen formulieren 
 Aanvulling (geen vervanging) unit testen 
 Staat los van Drupal (wel module beschikbaar) 
 Opstellen kan wat moeite kosten 
p. 61 
Selenium
Selenium voorbeeld (python) 
from selenium import webdriver 
p. 62 
… driver = webdriver.Firefox() 
driver.get("http://www.google.com") 
inputElement = driver.find_element_by_name("q") 
inputElement.send_keys("cheese!") 
inputElement.submit() 
try: 
WebDriverWait(driver, 10).until(EC.title_contains("cheese!")) 
print driver.title 
finally: 
driver.quit()
Vagrant 
 Scripten installatie devlopment-omgeving 
 Virtuele Machine 
p. 63 
 VMWare, VirtualBox, … 
 Provision tools 
 Shell scripts, Chef, Puppet, ... 
 https://www.vagrantup.com
© Fedict 2014. All rights reserved 
Drupal 6 / 7: Varia
Drupal 7: Entities 
 D6: Content Construction Kit 
 Enkel op Nodes (Content Types) 
p. 65 
 D7: Entity Types 
 Nodes, Comments, Taxonomy, Users 
 => extra velden, vertalingen (Entity Translation) 
 => Views, Rules 
 Entity API
 Uitschakelen niet-gebruikte modules 
 Drupal caching 
 Page cache / Block cache 
 Views query results cache 
 Eigen code: &drupal_static(__FUNCTION__) 
 CSS / Javascript aggregation (1 bestand) 
 PHP versie 
 Memcache 
p. 66 
Performantie
Drupal 8: vooruitblik
Gebaseerd op Symfony 2 
 Release: eind 2014 ?? 
 Hergebruik PHP framework 
 http://symfony.com/blog/symfony2-meets-drupal-8 
 http://cipix.nl/understanding-drupal-8-part-1-general-structure-framework 
p. 68 
 Voordelen 
 Interessanter voor niet-Drupal (PHP) developers 
 Laat toe om nieuwe functies sneller te ontwikkelen 
 Nadelen 
 Leercurve voor ervaren Drupal developers 
 Herschrijven modules en themes
Grote verbeteringen 
 Configuration Management 
 Gescheiden houden content en inhoud 
p. 69 
 (REST) Web Services 
 Makkelijker om feeds te maken / data binnen te halen 
 Meer functionaliteit standaard aanwezig 
 Meertaligheid, HTML Editor, Views 
 HTML5 / Mobile / Accessibility 
 Geen ondersteuning meer voor IE8
Gebruiksvriendelijke UI 
p. 70
Configuration Management 
 Configuration API 
 Uitwisselen via YAML files 
 Vb: van development naar productie-omgeving 
 (Oorspronkelijk niet in database, sinds kort wel) 
p. 71
p. 72 
Andere APIs 
 Validation API 
 Niet enkel meer voor formulieren (vb ook voor REST) 
 Voorbeeld: controle maximum waarde 
 State API 
 Niet verwarren met Configuration API 
 Voorbeeld: laatste keer dat cron uitgevoerd werd 
 In D6 / D7 meestal bijgehouden in Variable 
 Tour API 
 Gebaseerd op Joyride.js
p. 73 
Twig themes 
 Voordelen 
 Niet Drupal-specifiek 
 Ontwikkeld door de makers van Symfony 2 
 Leesbaarder 
 Geen PHP code meer in templates (= veiliger) 
 Nadeel 
 Leercurve voor ervaren Drupal themers
p. 74 
Twig voorbeeld 
{# 
This is a comment 
#} 
<div>{{ 'List'|t }}</div> 
<ul> 
{% for choice in menu %} 
<li>{{ choice.name }}</li> 
{% endfor %} 
</ul>
Wat met bestaande Drupal sites ? 
 Drupal 7 blijft ondersteund 
 Drupal 6 ? 
 Ondersteuning eindigt 3 maanden na release D8 
 https://www.drupal.org/node/2288521 
 Heel wat sites draaien nog op Drupal 6 ! 
 Upgrade naar D7 / D8 kan lastig zijn 
 Niet alle modules al beschikbaar / stabiel 
 => (betalende) ondersteuning door Drupal-bedrijven 
p. 75 
 “Backdrop” fork ?
 https://drupal.org/drupal-8.0 
 https://www.drupal.org/update/modules/7/8 
 https://www.acquia.com/blog/d8migrate 
 https://groups.drupal.org/core/twidc 
 https://www.drupal.org/node/2127611 
p. 76 
Meer informatie
Vragen ?
Bedankt ! 
Bart Hanssens / Fedict 
WTC III, Simon Bolivarlaan 30 
1000 Brussel, België 
@BartHanssens 
bart.hanssens [at] fedict.be | www.fedict.belgium.be

Introductie Drupal development

  • 1.
    Introductie Drupal INTECBrussel – 30 sept 2014
  • 2.
  • 3.
    p. 3 Overzicht  Over Fedict  LAMP stack  Drupal algemeen  Overzicht, community  Drupal 6 / 7  Opbouw, modules en distributies, talen  Drupal 8, vooruitblik  Sites en modules testen
  • 4.
  • 5.
    Federale Overheidsdienst voorICT  E-Gov componenten en diensten  Netwerk tussen gebouwen / internet (FedMAN)  Gegevensuitwisseling (Federal Service Bus)  Authenticatie (Federal Authentication Service)  Website platform en service (Drupal OpenFed)  Elektronische identiteitskaart  http://www.fedict.belgium.be/nl/service_catalogue  ICT medewerkers via Fedict Select p. 5  http://www.fedictselect.be
  • 6.
  • 7.
    Linux, Apache, MySQL,PHP p. 7 MySQL PHP Linux Apache
  • 8.
     Open sourcebesturingssysteem  Begonnen als hobbyproject in 1991  Alternatief voor dure Unix systemen  Van kleine tot grote systemen  Modem / routers (BeBox)  Smartphones / tablets (Android)  PCs  Supercomputers p. 8 Linux Larry Ewing, http://commons.wikimedia.org/wiki/File:Tux-shaded.svg
  • 9.
    p. 9 ApacheHTTPd  Open source webserver  Serie patches NCSA in 1995  Draait op Linux, Windows, BSD, OS X, ...  Ooit door 70% van alle sites gebruikt (nu 30%)  Erg veelzijdige server  Allerlei modules: proxy, beveiliging, scripts, logging, …  Deel van Apache Software Foundation
  • 10.
    MySQL  Opensource relationele database  Ontstaan in 1995  Draait op Linux, Windows, BSD …  C, Java, .Net, PHP, Python, Ruby … connectors  Firma gekocht door Sun (nu Oracle) in 2008  Product blijft open source...  … daarnaast ontstaan varianten zoals MariaDB, Drizzle p. 10  WebScaleSQL  Facebook, Twitter, LinkedIn (Google)
  • 11.
     Script taalvoor webpagina's  Begonnen in 1995 (“Personal Home Page”)  Draait op Linux, Windows, BSD …  Joomla, WordPress, phpMyAdmin, phpBB, ...  Nu meer aandacht voor performantie  APC, Zend Opcache / Optimizer+ … opcode cache  Facebook HipHop / HHVM compiler p. 11 PHP
  • 12.
  • 13.
  • 14.
    Drupal  (Web)Content Management Systeem p. 14  Ontstaan in 2001  Open source (GPL)  1000-en modules  Workflow, integratie, beheer, e-shop, ...  Meestal op LAMP  Draait soms ook op BSD, MacOS X, MS-Windows  … op nginx, IIS webserver  … Postgres, MS SQL Server / Azure database
  • 15.
    Sterke punten Actieve gebruikersgroepen  Geen licentiekosten  Veel documentatie p. 15  Handboeken, online  Zeer veel mogelijkheden  Uitbreiden functionaliteit, wijzigen lay-out  Zeer populair  Veel kleine en grotere Drupal-bedrijven
  • 16.
     100-en overheidssitesin België  ZuinigMetStraling, OFO-IFA, HRJ, Civiele Veiligheid ...  Overheidssites in het buitenland  WhiteHouse.gov, maar ook in Australië, Frankrijk, ...  StuBru, Vier, VTM, Kinepolis  Amnesty Int, UNICEF.be, Greenpeace UK  Carrefour, Essent, Tesla Motors p. 16 Zeer populair
  • 17.
     Standaard zoekmotoris beperkt  Geen autocomplete, wildcard, search in documenten  => Oplossing is Apache Solr / Lucene + Tika (Java)  Meerdere talen op 1 site is soms lastig  Extra modules en configuratie nodig  => Eindelijk “out-of-the-box” in Drupal 8  Mix van content- / configuratiebeheer  Zeer moeilijk om enkel content / config te kopiëren  => Drupal 8 p. 17 Zwakke punten
  • 18.
     Elke majorrelease heeft andere API  Modules moeten vaak opnieuw ontwikkeld worden  Niet bedoeld voor documentbeheer  Wel integratie met bijvoorbeeld Alfresco mogelijk p. 18 Zwakke punten (2)
  • 19.
    Voorbeelden integraties p.19  Documentbeheer  Alfresco (via CMIS module)  Multimedia  Youtube, Vimeo (Media module)  Sociale Media  Twitter, Facebook (AddThis, ShareThis...)  Statistieken  GoogleAnalytics
  • 20.
    Drupal en Solrsearch File (extractie PDF,...) p. 20 Solr server (Java) Drupal (PHP) Apache Solr Modules Tika Lucene (index) Content
  • 21.
    p. 21 Snelvan start  Website  http://drupal.org  Online site bouwen (gratis maar wat beperkt)  http://simplytest.me/  http://www.drupalgardens.com/  http://www.acquia.com/acquia-cloud-free
  • 22.
    Snel van start(eigen machine)  Oracle VirtualBox (desktop)  Open source virtualisatie  MacOS X, Linux, MS-Windows  https://www.virtualbox.org/ p. 22  Virtuele machines  http://www.turnkeylinux.org/  LAMP stack voor MacOS / Windows / Linux  Goed voor development, niet voor productie  https://www.apachefriends.org/index.html
  • 23.
    © Fedict 2014.All rights reserved Drupal: community
  • 24.
    Beheer op drupal.org,voordelen  “Project” voor themes, modules, ...  Referentie (klanten / werkgevers)  Gratis + bespaart werk  Automatisch aanmaken downloads  Bij correct gebruik: link bug ticket naar fix in code  Automatische tests mogelijk  Statistieken aantal sites die module gebruiken  Enkel sites die “Update” module hebben geactiveerd  Enkel totalen, geen gedetailleerde lijst van sites p. 24
  • 25.
  • 26.
    Projectpagina: functies p.26  Algemene informatie  Beschrijving, lijst ontwikkelaars, downloads  Statistieken, laatste activiteit  Eventueel link naar gelijkaardige projecten, documentatie  Issue tracker  Bugs, vragen, aanvraag nieuwe functies  Iedereen mag commentaar geven / patches sturen
  • 27.
     Ontwikkeld doorLinus Torvalds  Oorspronkelijk om versies Linux kernel te beheren  Beschikbaar voor Linux, Windows, MacOS X...  “Wie” heeft “wat” “wanneer” gewijzigd  Terugkeren naar vorige versie is mogelijk  Commentaar toevoegen “waarom”  Link met projectpagina op Drupal.org  Git “Issue #12345 ...” wordt gelinkt aan ticket 12345 p. 27 Git versiebeheer
  • 28.
  • 29.
    Zelf project makendrupal.org  Iedereen kan sandbox project aanmaken  Projectpagina, git, …  (Nog) geen unieke projectnaam (enkel nummer)  Full projects door “goedgekeurde” developers  Unieke naam op drupal.org  “Promotie” sandbox => full is mogelijk  Mogelijkheid om anderen toegang te geven  Beheren tickets, beheren projectpagina, ... p. 29
  • 30.
    Eenmalige developer /code review  Niet vereist om patches op te sturen  Voor wie zelf modules... op d.o. wil beheren  Doel: verhogen kwaliteit modules  Eenmalige review door andere drupal.org developers  Nakijken correct gebruik Drupal API, documentatie...  Kan helaas weken / maanden duren (vrijwilligers)  Nadien onbeperkt aanmaken projecten p. 30
  • 31.
    Marketplace  Lijstvan Drupal-bedrijven  Training, hosting, ontwikkeling, …  Gekoppeld aan activiteiten / projecten op d.o. p. 31  Lijst van Drupal-boeken
  • 32.
    © Fedict 2014.All rights reserved Drupal 6 / 7: opbouw
  • 33.
    Module Module ProfileTheme Library Module Module Theme p. 33 Distributie Van module tot distributie Module Module Theme Core Module Module Library
  • 34.
    p. 34 Themes  Layout  2 000+ gratis themes  Mix van HTML / CSS / Javascript en/of PHP  Subthemes mogelijk  Gebaseerd op / variant van bestaand theme  Sneller te ontwikkelen, vaak al “mobile”, “responsive”  Populaire “base themes”: Zen, Omega
  • 35.
    Modules  Coremodules (standaard in Drupal) p. 35  Blog, Page, ...  Contrib modules  25 000+ gratis modules  Wisselende kwaliteit en ondersteuning  Verbetering functies / extra mogelijkheden  Integratie Google / Facebook / Twitter … diensten  Workflow, eCommerce, beheer content / gebruikers, ...
  • 36.
    Libraries  Geschrevenin PHP en/of Javascript  Visuele effecten / opmaak p. 36  Jquery Cycle, SuperFish, ...  Integratie met andere diensten  OpenLayers, MailChimp, ...  Online HTML editor  Zit niet standaard in D6 / D7 (wel in D8)  CKEditor, TinyMCE
  • 37.
    (Installation) profiles endistributies p. 37  Installation profiles  Keuze (enkel) bij installatie  Verzameling modules, themes, libraries  Gescripte configuratie van deze modules  800 distributies  Core + installation profile(s), modules, themes …  Commerce Kickstart, OpenFed, Acquia Commons, ...
  • 38.
    © Fedict 2014.All rights reserved Drupal 6 / 7: modules
  • 39.
    Goeie informatici zijnlui http://commons.wikimedia.org/wiki/File:Lazzaro1.jpg p. 39
  • 40.
    Zelf een modulebouwen ? p. 40 Bestaat er al een module ? Actieve ontwikkeling (Co-) maintainer worden ? Patch mogelijk ? Eigen module J N J N N N J Patch J
  • 41.
    Bestanden van eenmodule p. 41  <module>.info  Naam, versie van module, afhankelijkheden  <module>.install  Code installatie / upgrade / verwijderen module  <module>.module / <module>.inc  Eigenlijke module en include files  <module>.test  SimpleTest bestanden
  • 42.
    p. 42 .infovoorbeeld name = Date description = Makes date/time fields available. project = "date" version = "7.x-2.8" package = Date/Time core = 7.x Php = 5.2 dependencies[] = date_api files[] = date.migrate.inc files[] = tests/date_api.test files[] = tests/date.test
  • 43.
    Drupal API Lijst van Drupal functies, constanten  Form API / builder p. 43  Formulieren  Hooks  Installatie / verwijderen module  Toevoegen / verwijderen content / gebruikers / menu's  Menu's, fields, ...
  • 44.
    Menu hook voorbeeld p. 44 /** * Implements hook_menu(). */ function devel_menu() { ... $items['devel/settings'] = array( 'title' => 'Devel settings', 'description' => 'Helper functions, pages', 'page callback' => 'drupal_get_form', 'page arguments' => array('devel_admin_settings'), 'access arguments' => array('administer site configuration'), 'file' => 'devel.admin.inc', 'menu_name' => 'devel', ); ... return system_settings_form($form); }
  • 45.
    © Fedict 2014.All rights reserved Drupal 6 / 7: distributies
  • 46.
    Wanneer een distributiebouwen ?  Veel sites op zelfde platform  Voordelen:  Sneller beginnen met sites te ontwikkelen  Makkelijker te onderhouden (bij strikt beheer) p. 46  Nadelen:  Beetje configuratiewerk  Minder flexibel
  • 47.
    Drush tool Command line (php) tools  Modules (des)activeren, backups, …  Uitbreidbaar met eigen commando's p. 47  Drush make  Bundelen core, modules, patches, themes...  Bij voorkeur exacte versienummers gebruiken
  • 48.
    p. 48 Makefilevoorbeeld libraries[colorbox][download][type] = "get" libraries[colorbox][download][url] = "https://github.com/jackmoore/colorbox/archive/1.5.13.zip" libraries[colorbox][directory_name] = "colorbox" libraries[colorbox][type] = "library" projects[admin_language][download][type] = git projects[admin_language][download][branch] = "7.x-1.x" projects[admin_language][download][revision] = 6f0a6e5 projects[admin_language][subdir] = contrib projects[i18n][version] = "1.11" projects[i18n][subdir] = contrib projects[i18n][patch][2250501] = "http://drupal.org/files/issues/i18n-node_ edit-2250501-8.patch"
  • 49.
    Licenties  Opensource =/= zonder licentiebepalingen  Beperkingen / verplichtingen  Verschillende licenties niet altijd compatibel p. 49  Drupal: GPL v2 of later  Code beschikbaar stellen aan gebruiker  Gebruikers mogen code doorgeven  Drupal: whitelist compatibele componenten  Alle drupal.org modules / themes …  Enkele externe modules / libraries ...
  • 50.
    Distributie op drupal.org  Projectpagina etc zoals bij module  Gecontroleerde drush make file  Enkel “full” modules / themes van drupal.org  Beperkte lijst toegestane libraries  https://drupal.org/project/drupalorg_whitelist p. 50
  • 51.
    © Fedict 2014.All rights reserved Drupal 6 / 7: meertaligheid
  • 52.
    p. 52 Meertaligheid http://commons.wikimedia.org/wiki/File:Br%C3%BCssel_%28Ortstafel%29.jpg
  • 53.
     Labels, foutboodschappen...  Standaard mails, site slogan, ...  Navigatie / menu's  Drop-down lijsten / taxonomies  Inhoud pagina's p. 53 Vertalingen
  • 54.
     (Veel) extramodules nodig  i18n, i18nviews, entity translation  Vertaling niet altijd 1-op-1  Vb: NL + FR site met beperkte vertaling naar EN + DE  Wat met menu's ? Pagina's die enkel in 1 taal bestaan ?  Vertaling gebeurt op verschillende plaatsen  Ook verschillende rechten nodig p. 54 Aandachtspunten
  • 55.
    Vertaling van inhoud p. 55  Drupal 6  Vertaling per “node”, elke vertaalde node een andere ID  => wat met bijvoorbeeld “likes” (vertaalde of alle nodes ?)  “Synchroon” houden auteur, datum … ? (i18nsync)  Drupal 7  Vertaling per node, zoals in D6  Of per veld (entity translation)  => zelfde ID, maar werkt niet altijd met alle modules
  • 56.
    © Fedict 2014.All rights reserved Sites en modules testen
  • 57.
    Simpletest module Standaard in D7 (“Testing”) module p. 57  Aparte module in D6  Testen van functies tijdens ontwikkeling  Niet verplicht, wel sterk aan te raden  Testen kunnen ook automatisch draaien op d.o.
  • 58.
    Simpletest voorbeeld p.58 <?php public function setUp() { parent::setUp('simpletest_demo'); $this->privileged_user = $this->drupalCreateUser( array('create simpletest_demo', 'edit own simpletest_demo')); $this->drupalLogin($this->privileged_user); } public function testSimpleTestDemoCreate() { $edit = array(); $edit['title'] = 'SimpleDemo'; $edit['body'] = $this->randomName(80); $this->drupalPost('node/add/simpletest-demo', $edit, t('Save')); $this->assertText(t('SimpleDemo has been created.')); } ?>
  • 59.
  • 60.
    Hulpmiddelen  Automatischecode review  http://pareview.sh  Documentatie, correct gebruik API, naamgeving...  Tips ivm veiligheid en performantie  Eigen te schrijven unit tests (SimpleTest)  https://drupal.org/simpletest p. 60  Development module  https://drupal.org/project/devel
  • 61.
     Automatiseren testenvia browser  Aansturen IE, Firefox, Chrome, … via script / code  Java, Python, C#, Ruby, (PHP)  http://www.seleniumhq.org  Nabootsen wat gebruiker doet / ziet  Klikken, uploaden files, invullen formulieren  Aanvulling (geen vervanging) unit testen  Staat los van Drupal (wel module beschikbaar)  Opstellen kan wat moeite kosten p. 61 Selenium
  • 62.
    Selenium voorbeeld (python) from selenium import webdriver p. 62 … driver = webdriver.Firefox() driver.get("http://www.google.com") inputElement = driver.find_element_by_name("q") inputElement.send_keys("cheese!") inputElement.submit() try: WebDriverWait(driver, 10).until(EC.title_contains("cheese!")) print driver.title finally: driver.quit()
  • 63.
    Vagrant  Scripteninstallatie devlopment-omgeving  Virtuele Machine p. 63  VMWare, VirtualBox, …  Provision tools  Shell scripts, Chef, Puppet, ...  https://www.vagrantup.com
  • 64.
    © Fedict 2014.All rights reserved Drupal 6 / 7: Varia
  • 65.
    Drupal 7: Entities  D6: Content Construction Kit  Enkel op Nodes (Content Types) p. 65  D7: Entity Types  Nodes, Comments, Taxonomy, Users  => extra velden, vertalingen (Entity Translation)  => Views, Rules  Entity API
  • 66.
     Uitschakelen niet-gebruiktemodules  Drupal caching  Page cache / Block cache  Views query results cache  Eigen code: &drupal_static(__FUNCTION__)  CSS / Javascript aggregation (1 bestand)  PHP versie  Memcache p. 66 Performantie
  • 67.
  • 68.
    Gebaseerd op Symfony2  Release: eind 2014 ??  Hergebruik PHP framework  http://symfony.com/blog/symfony2-meets-drupal-8  http://cipix.nl/understanding-drupal-8-part-1-general-structure-framework p. 68  Voordelen  Interessanter voor niet-Drupal (PHP) developers  Laat toe om nieuwe functies sneller te ontwikkelen  Nadelen  Leercurve voor ervaren Drupal developers  Herschrijven modules en themes
  • 69.
    Grote verbeteringen Configuration Management  Gescheiden houden content en inhoud p. 69  (REST) Web Services  Makkelijker om feeds te maken / data binnen te halen  Meer functionaliteit standaard aanwezig  Meertaligheid, HTML Editor, Views  HTML5 / Mobile / Accessibility  Geen ondersteuning meer voor IE8
  • 70.
  • 71.
    Configuration Management Configuration API  Uitwisselen via YAML files  Vb: van development naar productie-omgeving  (Oorspronkelijk niet in database, sinds kort wel) p. 71
  • 72.
    p. 72 AndereAPIs  Validation API  Niet enkel meer voor formulieren (vb ook voor REST)  Voorbeeld: controle maximum waarde  State API  Niet verwarren met Configuration API  Voorbeeld: laatste keer dat cron uitgevoerd werd  In D6 / D7 meestal bijgehouden in Variable  Tour API  Gebaseerd op Joyride.js
  • 73.
    p. 73 Twigthemes  Voordelen  Niet Drupal-specifiek  Ontwikkeld door de makers van Symfony 2  Leesbaarder  Geen PHP code meer in templates (= veiliger)  Nadeel  Leercurve voor ervaren Drupal themers
  • 74.
    p. 74 Twigvoorbeeld {# This is a comment #} <div>{{ 'List'|t }}</div> <ul> {% for choice in menu %} <li>{{ choice.name }}</li> {% endfor %} </ul>
  • 75.
    Wat met bestaandeDrupal sites ?  Drupal 7 blijft ondersteund  Drupal 6 ?  Ondersteuning eindigt 3 maanden na release D8  https://www.drupal.org/node/2288521  Heel wat sites draaien nog op Drupal 6 !  Upgrade naar D7 / D8 kan lastig zijn  Niet alle modules al beschikbaar / stabiel  => (betalende) ondersteuning door Drupal-bedrijven p. 75  “Backdrop” fork ?
  • 76.
     https://drupal.org/drupal-8.0 https://www.drupal.org/update/modules/7/8  https://www.acquia.com/blog/d8migrate  https://groups.drupal.org/core/twidc  https://www.drupal.org/node/2127611 p. 76 Meer informatie
  • 77.
  • 78.
    Bedankt ! BartHanssens / Fedict WTC III, Simon Bolivarlaan 30 1000 Brussel, België @BartHanssens bart.hanssens [at] fedict.be | www.fedict.belgium.be