SlideShare a Scribd company logo
1 of 34
Drupal development
    Introductie
     hans.rossel@koba.be
        www.koba.be
        Twitter: @haro
Boeken
Video
Lullabot videos (d6): http://store.lullabot.com/ Of 
 www.drupalize.me
Build a module: http://buildamodule.com 
www.archive.org: alle Drupalcon conferentie opnames
Drush
Drush: Drupal Shell
Drush = Drupal shell = command line Drupal
http://drupal.org/project/drush
    http://vimeo.com/5207683 
    Extra http://drupal.org/taxonomy/term/4654
    http://www.archive.org/details/DrupalconSf2010Drush
    http://www.archive.org/details/DrupalconSf2010AdvancedDrush 


Installatie Drush: zie readme.txt file
Drush commando
                    voorbeelden
Drupal installeren in htdocs of www mapje
   drush (help uitleg)
   drush dl (download drupal)
   drush dl cck views nl ckeditor acquia_marina backup_migrate (in drupal map)
   drush en cck views (modules aanleggen, omgekeerd: dis)
   drush cron

Drupal updaten met drush
   drush bam backup of drush sql­dump > example10052010.sql
   tar ­czf drupal.tgz drupal
   drush variable­set site_offline TRUE
   drush up: update alle modules + backup code
   drush updb: run update.php
   drush variable­set site_offline FALSE
Drush make
Drush make: bundelen van de automatisaties
Installeren: drush dl drush_make
Makefile opstellen:
  Drush generate makefile /opt/lampp/htdocs/makefiles/example.make
  Drush convert makefile example.make example.make

drush make example.make example (maakt een drupal 
  site op /example)
Drush make structuur
core = 6.x


projects[] = drupal
projects[] = cck
projects[] = views


Uitgebreid voorbeeld: 
  http://drupalcode.org/viewvc/drupal/contributions/profiles/openatrium/openatrium.make?revision=1.38&view=markup
   
Werkomgeving
Versie controle
Bij het samenwerken van verschillende mensen aan dezelfde code: 
  bijhouden versies, mergen en oplossen van code conflicten, staging en 
  deployment
Systemen: 
   cvs, svn (centralised repository)
   Git, mercurial, bzr (distributed repository)
Populariteit van github noodzaakte drupal.org over te schakelen van de 
  oude cvs naar git op 24 feb 2011
Contributen aan Drupal: http://drupal.org/documentation/git 
IDE
Eclipse PDT with the plugin 'PHP debugger support for PDT'.
   http://drupal.org/project/eclipse: hook_... templates
   http://xtnd.us/eclipse/install Drupal for Eclipse
Netbeans
Aptana
Komodo
Coda
Sublime text
Codekit
Debugger
Xdebug
Stap voor stap bekijken wat er allemaal gebeurt na een 
  page request
Breakpoints
Backtrace
https://addons.mozilla.org/en­US/firefox/addon/easy­xdeb
   
http://krimson.be/articles/drupal­coding­speed­tips­using­i
   
api.drupal.org
Drupal (core) bevat erg veel comments waardoor de 
 handleiding eigenlijk in de code zit
api.drupal.org wordt automatisch opgebouwd met de 
  api module (http://drupal.org/project/api) op basis 
  van Drupal core.
Om een volledige documentatie te hebben van alle 
 modules (dus incl contrib) op je site kun je zelf de 
 api module toepassen of bijvoorbeeld 
 http://api.lullabot.com gebruiken. 
Modules upgraden 6->7
http://drupal.org/update/modules/6/7
Coder module kan gedeeltelijk upgrades 
 automatiseren: http://drupal.org/project/coder
Coder live site: http://upgrade.boombatower.com 
Drupal coding standards
http://drupal.org/coding­standards
Coder module (http://drupal.org/project/coder)
  Voorziet een automatische scanning naar fouten tegen 
   coding standards
Devel module
Bestaat uit: Devel, devel generate, devel node_access 
 en devel performance logging
Blokken: development, execute php, switch user
Theme developer voor theming
Execute php: global $user; dsm($user)
Basiscomponenten
Nodes (entities + fields)
Users: global $user, verschil met $account
Blokken
Menus
Views
Drupal database systeem
User: nieuw paswoord via shell script wegens salt
System: alle modules en hun gewichten
Sessions, ...
Drupal bestandsysteem
/modules: core modules
/sites/all/modules: contrib modules
/sites/default/modules: eigen modules (tenzij bij 
  multisite configuratie)
Module opbouw
.info: definitie, dependencies, versie
.module: gewoon php code 
.install: wordt geladen bij installatie/enabled, database 
   tabellen en variables
.inc: opsplitsen van diverse delen, vb admin de
.tpl.php: html output
.css: css output
Translations: .po bestanden
Tests php simpletest
Voorbeeldmodules
Alle modules van Drupal core
  Zijn heel grondig becommentarieerd en door vele 
    programmeurs verfijnd
http://drupal.org/project/examples
  Voorbeeldmodules van veelvoorkomende setups
Functies
Veelvoorkomende functies
L();
node_load();
node_view();
Arg();
T();
variable_set(); variable_get(); variable_del();
format_date()
drupal_set_message();
http://www.ventureweb.net/blog/great­drupal­functions
Secure code
http://drupal.org/writing­secure­code
Filteren van data
  check_plain()
  check_markup()
  t()
  filter_xss(): voor admin pagina's
Database queries
  Gebruik van placeholders
Hooks
Drupal hooks
Don't hack core!
http://api.drupal.org/api/drupal/includes­­
  module.inc/group/hooks
Wijzigingen aanbrengen in Drupal core of andere 
 modules zonder die te modules te wijzigen
Spelen in op bepaalde events die gebeuren tijdens de 
 opbouw van een pagina: 
  Een gebruiker logt in
  De node wordt getoond
  Het menu wordt opgebouwd
  Een formulier wordt verwerkt
hook_form_alter
Mogelijkheid om elk formulier op de site te wijzigen 
 via form api
Form api: http://api.drupal.org/api/drupal/developer­­topics­­forms_api_reference.html/7: definitie 
   van forms, validate en submit functies


Stappen
     Bepaal de form_id
     Maak abc_form_FORM_ID_alter in je module
     dsm($form) of print_r($form)
     Doe de gewenste wijzingen
Andere hooks
hook_help();
hook_menu();
hook_permission(); => user_access();
hook_mail();
hook_user();
hook_block_info();
hook_node_...();
Definitie node
Zie node_example module
hook_entity_...: Nodes zijn een soort van fieldable 
  entities
hook_entity_info(): definitie van de entity die je 
  definieert
Definitie fields
Gebruik van Field api
Zie ook field_example module
hook_field_info()
hook_field_...()
Structuur, schema, validatie, widget, widget_form, 
  formatter
Database layer
   DBTNG
Db abstraction layer
Abstratie laag gebaseerd op php pdo: Schema api
http://api.drupal.org/api/drupal 
Wordt gedefinieerd in hook_schema() in het .install 
 bestand van de module
Gebruik de Schema module voor definitie 
 www.drupal.org/project/schema
   Definieer lege abc_schema() in .install van je module
   Maak je database tabellen met phpmyadmin
   Schema module: Inspect tab geeft je de code
Database queries
Gebruik db_query en placeholders
http://api.drupal.org/api/drupal/includes­­database­­databa


Gebruik db_rewrite_sql ivm node_access modules
<?php
 $result = db_query(db_rewrite_sql("SELECT n.nid, 
  n.title FROM {node} n")); 
?>
References
Drupal module development guide:
http://drupal.org/developing/modules
Api: http://api.drupal.org  
Working with the Drupal api: 
 http://drupal.org/node/326
Field api en fieldable entities maken: 
  http://drupal.org/node/443536 

More Related Content

What's hot

Drupal 7 Theming
Drupal 7 ThemingDrupal 7 Theming
Drupal 7 ThemingHans Rossel
 
Website Usability deel 3: vervolg WordPress
Website Usability deel 3: vervolg WordPressWebsite Usability deel 3: vervolg WordPress
Website Usability deel 3: vervolg WordPressPeter Luit
 
Drupal koba-nov2013
Drupal koba-nov2013Drupal koba-nov2013
Drupal koba-nov2013Hans Rossel
 
Online Usability training Hogeschool Utrecht - CCJ
Online Usability training Hogeschool Utrecht - CCJOnline Usability training Hogeschool Utrecht - CCJ
Online Usability training Hogeschool Utrecht - CCJPeter Luit
 
Introductie Drupal development
Introductie Drupal developmentIntroductie Drupal development
Introductie Drupal developmentBart Hanssens
 
Online usability - les 1 introductie WordPress - structuur en content
Online usability - les 1 introductie WordPress - structuur en contentOnline usability - les 1 introductie WordPress - structuur en content
Online usability - les 1 introductie WordPress - structuur en contentPeter Luit
 
Hyperlocal Academy - deel 2: techniek
Hyperlocal Academy - deel 2: techniekHyperlocal Academy - deel 2: techniek
Hyperlocal Academy - deel 2: techniekPeter Luit
 
Drupal6 Css Theming
Drupal6 Css ThemingDrupal6 Css Theming
Drupal6 Css ThemingRoy Scholten
 
Les 3 Inct. Training WordPress
Les 3 Inct. Training WordPressLes 3 Inct. Training WordPress
Les 3 Inct. Training WordPressPeter Luit
 
How to create a Drupal theme (Dut
How to create a Drupal theme (DutHow to create a Drupal theme (Dut
How to create a Drupal theme (DutN digital studio
 
Online usability - les 2 introductie WordPress
Online usability - les 2 introductie WordPressOnline usability - les 2 introductie WordPress
Online usability - les 2 introductie WordPressPeter Luit
 
Linux command-line-magic-jdnl15
Linux command-line-magic-jdnl15Linux command-line-magic-jdnl15
Linux command-line-magic-jdnl15Peter Martin
 
Wordpress Training Deel 1 2-3 - Handout
Wordpress Training Deel 1 2-3 - HandoutWordpress Training Deel 1 2-3 - Handout
Wordpress Training Deel 1 2-3 - HandoutWonderlijk Werken
 
Online usability - les 3 introductie WordPress - thema's, widgets en plugins
Online usability - les 3 introductie WordPress - thema's, widgets en pluginsOnline usability - les 3 introductie WordPress - thema's, widgets en plugins
Online usability - les 3 introductie WordPress - thema's, widgets en pluginsPeter Luit
 

What's hot (14)

Drupal 7 Theming
Drupal 7 ThemingDrupal 7 Theming
Drupal 7 Theming
 
Website Usability deel 3: vervolg WordPress
Website Usability deel 3: vervolg WordPressWebsite Usability deel 3: vervolg WordPress
Website Usability deel 3: vervolg WordPress
 
Drupal koba-nov2013
Drupal koba-nov2013Drupal koba-nov2013
Drupal koba-nov2013
 
Online Usability training Hogeschool Utrecht - CCJ
Online Usability training Hogeschool Utrecht - CCJOnline Usability training Hogeschool Utrecht - CCJ
Online Usability training Hogeschool Utrecht - CCJ
 
Introductie Drupal development
Introductie Drupal developmentIntroductie Drupal development
Introductie Drupal development
 
Online usability - les 1 introductie WordPress - structuur en content
Online usability - les 1 introductie WordPress - structuur en contentOnline usability - les 1 introductie WordPress - structuur en content
Online usability - les 1 introductie WordPress - structuur en content
 
Hyperlocal Academy - deel 2: techniek
Hyperlocal Academy - deel 2: techniekHyperlocal Academy - deel 2: techniek
Hyperlocal Academy - deel 2: techniek
 
Drupal6 Css Theming
Drupal6 Css ThemingDrupal6 Css Theming
Drupal6 Css Theming
 
Les 3 Inct. Training WordPress
Les 3 Inct. Training WordPressLes 3 Inct. Training WordPress
Les 3 Inct. Training WordPress
 
How to create a Drupal theme (Dut
How to create a Drupal theme (DutHow to create a Drupal theme (Dut
How to create a Drupal theme (Dut
 
Online usability - les 2 introductie WordPress
Online usability - les 2 introductie WordPressOnline usability - les 2 introductie WordPress
Online usability - les 2 introductie WordPress
 
Linux command-line-magic-jdnl15
Linux command-line-magic-jdnl15Linux command-line-magic-jdnl15
Linux command-line-magic-jdnl15
 
Wordpress Training Deel 1 2-3 - Handout
Wordpress Training Deel 1 2-3 - HandoutWordpress Training Deel 1 2-3 - Handout
Wordpress Training Deel 1 2-3 - Handout
 
Online usability - les 3 introductie WordPress - thema's, widgets en plugins
Online usability - les 3 introductie WordPress - thema's, widgets en pluginsOnline usability - les 3 introductie WordPress - thema's, widgets en plugins
Online usability - les 3 introductie WordPress - thema's, widgets en plugins
 

Similar to Drupal7 Development

Lucius Drupal Development Cursus
Lucius Drupal Development CursusLucius Drupal Development Cursus
Lucius Drupal Development CursusLuciuswebsystems
 
General Drupal presentation in Dutch
General Drupal  presentation in DutchGeneral Drupal  presentation in Dutch
General Drupal presentation in DutchRoel Meester
 
Lucius Websystems Drupal Startersdag
Lucius Websystems Drupal StartersdagLucius Websystems Drupal Startersdag
Lucius Websystems Drupal StartersdagLuciuswebsystems
 
Drupal Uitgebreide Starters Training
Drupal Uitgebreide Starters TrainingDrupal Uitgebreide Starters Training
Drupal Uitgebreide Starters TrainingLuciuswebsystems
 
UiTwidgets build on Drupal7 by CultuurNet
UiTwidgets build on Drupal7 by CultuurNetUiTwidgets build on Drupal7 by CultuurNet
UiTwidgets build on Drupal7 by CultuurNetSven Houtmeyers
 
Oplijsting mogelijkheden open source
Oplijsting mogelijkheden open sourceOplijsting mogelijkheden open source
Oplijsting mogelijkheden open sourceguesta83c7d
 
oplijsting_mogelijkheden_open_source
oplijsting_mogelijkheden_open_sourceoplijsting_mogelijkheden_open_source
oplijsting_mogelijkheden_open_sourceguesta83c7d
 
Drupal + Open Atrium bij de Vlaamse Erfgoedbibliotheek
Drupal + Open Atrium bij de Vlaamse ErfgoedbibliotheekDrupal + Open Atrium bij de Vlaamse Erfgoedbibliotheek
Drupal + Open Atrium bij de Vlaamse ErfgoedbibliotheekDavid Coppoolse
 
Drupal introductie - GoalGorilla - Oxilion Lunch &amp; Learn
Drupal introductie - GoalGorilla - Oxilion Lunch &amp; LearnDrupal introductie - GoalGorilla - Oxilion Lunch &amp; Learn
Drupal introductie - GoalGorilla - Oxilion Lunch &amp; Learntaccie
 
Eduvision - Webinar drupal: gratis online cursus Drupal
Eduvision - Webinar drupal: gratis online cursus DrupalEduvision - Webinar drupal: gratis online cursus Drupal
Eduvision - Webinar drupal: gratis online cursus DrupalEduvision Opleidingen
 
Hoe CMI in Drupal features overbodig maakt (of toch niet) - Drupal Tech Talk ...
Hoe CMI in Drupal features overbodig maakt (of toch niet) - Drupal Tech Talk ...Hoe CMI in Drupal features overbodig maakt (of toch niet) - Drupal Tech Talk ...
Hoe CMI in Drupal features overbodig maakt (of toch niet) - Drupal Tech Talk ...Triquanta
 
V-ICT-OR SHOPT IT 2014
V-ICT-OR SHOPT IT 2014V-ICT-OR SHOPT IT 2014
V-ICT-OR SHOPT IT 2014V-ICT-OR
 
XPages Introductie
XPages IntroductieXPages Introductie
XPages IntroductieRob Bontekoe
 
Webinar overstap van DevOps naar GitHub.pdf
Webinar overstap van DevOps naar GitHub.pdfWebinar overstap van DevOps naar GitHub.pdf
Webinar overstap van DevOps naar GitHub.pdfDelta-N
 
Drupal workshop 10-03-2011
Drupal workshop 10-03-2011Drupal workshop 10-03-2011
Drupal workshop 10-03-2011Hoppinger
 
TU/e - Back to the TYPO3 CMS basics
TU/e - Back to the TYPO3 CMS basicsTU/e - Back to the TYPO3 CMS basics
TU/e - Back to the TYPO3 CMS basicsPatrick Broens
 

Similar to Drupal7 Development (20)

Lucius Drupal Development Cursus
Lucius Drupal Development CursusLucius Drupal Development Cursus
Lucius Drupal Development Cursus
 
Drupalgardens
DrupalgardensDrupalgardens
Drupalgardens
 
General Drupal presentation in Dutch
General Drupal  presentation in DutchGeneral Drupal  presentation in Dutch
General Drupal presentation in Dutch
 
Lucius Websystems Drupal Startersdag
Lucius Websystems Drupal StartersdagLucius Websystems Drupal Startersdag
Lucius Websystems Drupal Startersdag
 
Drupal Uitgebreide Starters Training
Drupal Uitgebreide Starters TrainingDrupal Uitgebreide Starters Training
Drupal Uitgebreide Starters Training
 
Drupal 7 intro
Drupal 7 introDrupal 7 intro
Drupal 7 intro
 
UiTwidgets build on Drupal7 by CultuurNet
UiTwidgets build on Drupal7 by CultuurNetUiTwidgets build on Drupal7 by CultuurNet
UiTwidgets build on Drupal7 by CultuurNet
 
Oplijsting mogelijkheden open source
Oplijsting mogelijkheden open sourceOplijsting mogelijkheden open source
Oplijsting mogelijkheden open source
 
oplijsting_mogelijkheden_open_source
oplijsting_mogelijkheden_open_sourceoplijsting_mogelijkheden_open_source
oplijsting_mogelijkheden_open_source
 
Drupal distros
Drupal distrosDrupal distros
Drupal distros
 
Drupal + Open Atrium bij de Vlaamse Erfgoedbibliotheek
Drupal + Open Atrium bij de Vlaamse ErfgoedbibliotheekDrupal + Open Atrium bij de Vlaamse Erfgoedbibliotheek
Drupal + Open Atrium bij de Vlaamse Erfgoedbibliotheek
 
Drupal introductie - GoalGorilla - Oxilion Lunch &amp; Learn
Drupal introductie - GoalGorilla - Oxilion Lunch &amp; LearnDrupal introductie - GoalGorilla - Oxilion Lunch &amp; Learn
Drupal introductie - GoalGorilla - Oxilion Lunch &amp; Learn
 
Eduvision - Webinar drupal: gratis online cursus Drupal
Eduvision - Webinar drupal: gratis online cursus DrupalEduvision - Webinar drupal: gratis online cursus Drupal
Eduvision - Webinar drupal: gratis online cursus Drupal
 
Hoe CMI in Drupal features overbodig maakt (of toch niet) - Drupal Tech Talk ...
Hoe CMI in Drupal features overbodig maakt (of toch niet) - Drupal Tech Talk ...Hoe CMI in Drupal features overbodig maakt (of toch niet) - Drupal Tech Talk ...
Hoe CMI in Drupal features overbodig maakt (of toch niet) - Drupal Tech Talk ...
 
V-ICT-OR SHOPT IT 2014
V-ICT-OR SHOPT IT 2014V-ICT-OR SHOPT IT 2014
V-ICT-OR SHOPT IT 2014
 
XPages Introductie
XPages IntroductieXPages Introductie
XPages Introductie
 
Drupal 7 Architectuur
Drupal 7 ArchitectuurDrupal 7 Architectuur
Drupal 7 Architectuur
 
Webinar overstap van DevOps naar GitHub.pdf
Webinar overstap van DevOps naar GitHub.pdfWebinar overstap van DevOps naar GitHub.pdf
Webinar overstap van DevOps naar GitHub.pdf
 
Drupal workshop 10-03-2011
Drupal workshop 10-03-2011Drupal workshop 10-03-2011
Drupal workshop 10-03-2011
 
TU/e - Back to the TYPO3 CMS basics
TU/e - Back to the TYPO3 CMS basicsTU/e - Back to the TYPO3 CMS basics
TU/e - Back to the TYPO3 CMS basics
 

Drupal7 Development