SlideShare ist ein Scribd-Unternehmen logo
1 von 32
Downloaden Sie, um offline zu lesen
Module Development - Get the
Drupal started
Pieter-Jan Drouillon
WHY
this talk?

2
d
Goo

Ability

How soon can they
start kicking ass?

Suck
threshold

ad
B

Time
http://buytaert.net/creating-passionate-users

3
WHO
is talking?

@pjdrouillon | pieterjd.ulyssis.be

4
DISCLAIMER
5
DEFINE
your module

6
Define your module
<name>.info file
name
description
core
files
Achmed's advice :)
sites/all/modules/<name>
7
HOOKS
8
When something happens...
your module can hook in on it

9
DEM
O

hook_menu
10
FORMS
11
DEM
O

To form or not to form ...
Forms = arrays
Form API
Reverse example
Add a menu entry
set callback to drupal_get_form
set argument to function returning render array

12
Let’s add a
submit function

DEM
O

<form_function>_submit($form, &$form_state)

13
What about ...
Validation?

DEM
O

<form_function>_validate($form, &$form_state)

14
BLOCKS
15
QR Block
On every page
With a QR code
Use Google Chart API
http://chart.googleapis.com/chart?
chs=150x150&cht=qr&chl=<url>

16
Define the block

DEM
O

hook_block_info
array with all the info
key > block name
info > Some information
hook_block_view($delta = ‘’)
delta > name of block to render
returns render array

17
PERMISSIONS
18
DEM
O

To show or not to show ...
hook_permission
array with all the info
key > permission’s (short) name
title > permission’s fullname
user_access
checks if logged in user has the right permission
user 1 bypass

19
PREPROCESS
20
»
21
Read more »

DEM
O

hook_preprocess
process of preparing HTML code
$author > name of author linking to user profile
hook_preprocess_hook
hook_preprocess_blog

22
DEM
O

hook_form_alter
23
“I need a signature!”

DEM
O

hook_form_alter
hook_form_FORM_ID_alter

24
“I sometimes need
a legal disclaimer”

DEM
O

Add a checkbox
There’s a catch :)

25
theming
26
“I want my
definition list”

DEM
O

Cannot just return html
use theming functions
theme(<hook>,...)
search in API for theme_<hook>

27
hook_theme

DEM
O

array with all the info
key > name of theme (item_list, dd, ...)
add a list of variables
write function to create HTML code
theme_dd($variables)

28
TAKE AWAY
29
Don’t give up
Join a (local) community
Recommended books
Pro Drupal 7 development
Pakt Drupal 7 Module Development
Recommended sites
api.drupal.org, www.lullabots.com &
www.drupalize.me, NodeOne
TODO: Check out Drush & github !

30
Q&A
31
Feedback & follow-up:
http://drupalcampgent.be/feedback

Weitere ähnliche Inhalte

Ähnlich wie Drupalcamp Gent 2012

10 New Things You Can Do with Drupal 8 Out-of-the-Box
10 New Things You Can Do with Drupal 8 Out-of-the-Box10 New Things You Can Do with Drupal 8 Out-of-the-Box
10 New Things You Can Do with Drupal 8 Out-of-the-Box
Suzanne Dergacheva
 
Scale Conference "Intro to Drupal" Douglas C. Hoffman
Scale Conference "Intro to Drupal" Douglas C. HoffmanScale Conference "Intro to Drupal" Douglas C. Hoffman
Scale Conference "Intro to Drupal" Douglas C. Hoffman
Doug Hoffman
 

Ähnlich wie Drupalcamp Gent 2012 (20)

Top 5 Non-Obvious Drupal Modules
Top 5 Non-Obvious Drupal ModulesTop 5 Non-Obvious Drupal Modules
Top 5 Non-Obvious Drupal Modules
 
Drupal training-by-ruchiwebsolutions
Drupal training-by-ruchiwebsolutionsDrupal training-by-ruchiwebsolutions
Drupal training-by-ruchiwebsolutions
 
FileMaker-Drupal Synchronization
FileMaker-Drupal SynchronizationFileMaker-Drupal Synchronization
FileMaker-Drupal Synchronization
 
Best Practices For Drupal Developers By Mir Nazim @ Drupal Camp India 2008
Best Practices For Drupal Developers By Mir Nazim @ Drupal Camp India 2008Best Practices For Drupal Developers By Mir Nazim @ Drupal Camp India 2008
Best Practices For Drupal Developers By Mir Nazim @ Drupal Camp India 2008
 
Flutter Forward EXTENDED - Flutter로 앱 개발 입문하기
Flutter Forward EXTENDED -  Flutter로 앱 개발 입문하기Flutter Forward EXTENDED -  Flutter로 앱 개발 입문하기
Flutter Forward EXTENDED - Flutter로 앱 개발 입문하기
 
Debugging in drupal 8
Debugging in drupal 8Debugging in drupal 8
Debugging in drupal 8
 
Drupal Workshop: Introducción al Backend de Drupal
Drupal  Workshop: Introducción al Backend de DrupalDrupal  Workshop: Introducción al Backend de Drupal
Drupal Workshop: Introducción al Backend de Drupal
 
Drupal Module Development - OSI Days 2010
Drupal Module Development - OSI Days 2010Drupal Module Development - OSI Days 2010
Drupal Module Development - OSI Days 2010
 
Drupal Module Development
Drupal Module DevelopmentDrupal Module Development
Drupal Module Development
 
An overview of the Windows Phone 7 platform
An overview of the Windows Phone 7 platformAn overview of the Windows Phone 7 platform
An overview of the Windows Phone 7 platform
 
Dolibarr - information for developers and partners - devcamp lyon 2019
Dolibarr - information for developers and partners - devcamp lyon 2019Dolibarr - information for developers and partners - devcamp lyon 2019
Dolibarr - information for developers and partners - devcamp lyon 2019
 
10 New Things You Can Do with Drupal 8 Out-of-the-Box
10 New Things You Can Do with Drupal 8 Out-of-the-Box10 New Things You Can Do with Drupal 8 Out-of-the-Box
10 New Things You Can Do with Drupal 8 Out-of-the-Box
 
Webform 8.x 5.x - DrupalCon Baltimore
Webform 8.x 5.x - DrupalCon BaltimoreWebform 8.x 5.x - DrupalCon Baltimore
Webform 8.x 5.x - DrupalCon Baltimore
 
DrupalCon LA 2015 Review
DrupalCon LA 2015 ReviewDrupalCon LA 2015 Review
DrupalCon LA 2015 Review
 
PHPNW Drupal as a Framework
PHPNW Drupal as a FrameworkPHPNW Drupal as a Framework
PHPNW Drupal as a Framework
 
Drupal Best Practices
Drupal Best PracticesDrupal Best Practices
Drupal Best Practices
 
Deploying Moodle With High Availability and auto-scale on Microsoft Azure pla...
Deploying Moodle With High Availability and auto-scale on Microsoft Azure pla...Deploying Moodle With High Availability and auto-scale on Microsoft Azure pla...
Deploying Moodle With High Availability and auto-scale on Microsoft Azure pla...
 
Scale Conference "Intro to Drupal" Douglas C. Hoffman
Scale Conference "Intro to Drupal" Douglas C. HoffmanScale Conference "Intro to Drupal" Douglas C. Hoffman
Scale Conference "Intro to Drupal" Douglas C. Hoffman
 
Working With The Symfony Admin Generator
Working With The Symfony Admin GeneratorWorking With The Symfony Admin Generator
Working With The Symfony Admin Generator
 
Why xamarin forms is awesome
Why xamarin forms is awesomeWhy xamarin forms is awesome
Why xamarin forms is awesome
 

Kürzlich hochgeladen

Kürzlich hochgeladen (20)

2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 
Artificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyArtificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : Uncertainty
 
Deploy with confidence: VMware Cloud Foundation 5.1 on next gen Dell PowerEdg...
Deploy with confidence: VMware Cloud Foundation 5.1 on next gen Dell PowerEdg...Deploy with confidence: VMware Cloud Foundation 5.1 on next gen Dell PowerEdg...
Deploy with confidence: VMware Cloud Foundation 5.1 on next gen Dell PowerEdg...
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)
 
Top 5 Benefits OF Using Muvi Live Paywall For Live Streams
Top 5 Benefits OF Using Muvi Live Paywall For Live StreamsTop 5 Benefits OF Using Muvi Live Paywall For Live Streams
Top 5 Benefits OF Using Muvi Live Paywall For Live Streams
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
 
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingRepurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
 
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
Top 10 Most Downloaded Games on Play Store in 2024
Top 10 Most Downloaded Games on Play Store in 2024Top 10 Most Downloaded Games on Play Store in 2024
Top 10 Most Downloaded Games on Play Store in 2024
 
Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of Terraform
 
HTML Injection Attacks: Impact and Mitigation Strategies
HTML Injection Attacks: Impact and Mitigation StrategiesHTML Injection Attacks: Impact and Mitigation Strategies
HTML Injection Attacks: Impact and Mitigation Strategies
 
Manulife - Insurer Innovation Award 2024
Manulife - Insurer Innovation Award 2024Manulife - Insurer Innovation Award 2024
Manulife - Insurer Innovation Award 2024
 

Drupalcamp Gent 2012