SlideShare ist ein Scribd-Unternehmen logo
1 von 12
Make A Module
A Practical Introduction to Module Development
Matt Butcher
    Senior Programmer at
     Palantir.net, Author
     mbutcher on d.o

http://twitter.com/technosophos
    http://technosophos.com
2009
2004
Our Goal
 Build a Drupal module from
scratch in 40 minutes or less.
Our Module

• One directory and two files.
• Using Drupal’s hook system.
• Add a new block that can be placed in one
  of the block regions.
• Add a new “page” (menu callback).
Begin with...

•   Module directory:
    paris/

•   Two files:                               module_name.info




    •   paris/paris.info
                             module_name                        module_name.*.inc
                                                                module_name.install


    •
                                                                   and others.
        paris/paris.module                                          (optional)
                                           module_name.module
The Info File
•   Contains information   •   Used by module system
    about a module             to learn about the
                               module
•   Plain text config file
The Module File
•   Contains PHP code

•   Hook implementations
    live here

•   Often, other supporting
    code is here, too

•   Drupal loads this
    automatically
Hooks
     Drupal looks for
    particular function
 patterns in module files.

Functions that conform to
 these patterns are called
 “hook implementations”.
                             http://www.flickr.com/photos/39321672@N07/3616749186/
hook_block()

• Use it to manage a block.
 • List
 • Display
 • Configure
hook_menu()


• Use it to register a URL pattern.
• “Menu items”, in this case, are names that
  Drupal associates with functions.
Learning More

• API.Drupal.org
• Handbooks on
  Drupal.org
• Various books

Weitere ähnliche Inhalte

Andere mochten auch

Stress Management Presentation
Stress Management PresentationStress Management Presentation
Stress Management Presentation
Pk Doctors
 
ppt on Stress management
ppt on Stress managementppt on Stress management
ppt on Stress management
Ram Jagraon
 

Andere mochten auch (12)

994187 mod 1
994187 mod 1994187 mod 1
994187 mod 1
 
Instructional Modules
Instructional ModulesInstructional Modules
Instructional Modules
 
Intertextual Perspectives - according to the 2015 HSC Syllabus rubric
Intertextual Perspectives - according to the 2015 HSC Syllabus rubricIntertextual Perspectives - according to the 2015 HSC Syllabus rubric
Intertextual Perspectives - according to the 2015 HSC Syllabus rubric
 
Challenges and Responses in the Implementation of the K to 12
Challenges and Responses in the Implementation of the K to 12Challenges and Responses in the Implementation of the K to 12
Challenges and Responses in the Implementation of the K to 12
 
K to 12 Basic Education Program frequently asked questions
K to 12 Basic Education Program frequently asked questionsK to 12 Basic Education Program frequently asked questions
K to 12 Basic Education Program frequently asked questions
 
What is stress
What is stressWhat is stress
What is stress
 
Stress Management
Stress ManagementStress Management
Stress Management
 
Stress
StressStress
Stress
 
Stress Management Presentation
Stress Management PresentationStress Management Presentation
Stress Management Presentation
 
Problems and Issues in the Philippine Educational System
Problems and Issues in the Philippine Educational SystemProblems and Issues in the Philippine Educational System
Problems and Issues in the Philippine Educational System
 
ppt on Stress management
ppt on Stress managementppt on Stress management
ppt on Stress management
 
How To Prepare A Basic Training Module
How To Prepare A Basic Training ModuleHow To Prepare A Basic Training Module
How To Prepare A Basic Training Module
 

Mehr von Matt Butcher (6)

Kubernetes Helm (Boulder Kubernetes Meetup, June 2016)
Kubernetes Helm (Boulder Kubernetes Meetup, June 2016)Kubernetes Helm (Boulder Kubernetes Meetup, June 2016)
Kubernetes Helm (Boulder Kubernetes Meetup, June 2016)
 
QueryPath: It's like PHP jQuery in Drupal!
QueryPath: It's like PHP jQuery in Drupal!QueryPath: It's like PHP jQuery in Drupal!
QueryPath: It's like PHP jQuery in Drupal!
 
QueryPath, Mash-ups, and Web Services
QueryPath, Mash-ups, and Web ServicesQueryPath, Mash-ups, and Web Services
QueryPath, Mash-ups, and Web Services
 
Mashups with Drupal and QueryPath
Mashups with Drupal and QueryPathMashups with Drupal and QueryPath
Mashups with Drupal and QueryPath
 
Drupal 6 JavaScript and jQuery
Drupal 6 JavaScript and jQueryDrupal 6 JavaScript and jQuery
Drupal 6 JavaScript and jQuery
 
Foundations Of Info Justice
Foundations Of Info JusticeFoundations Of Info Justice
Foundations Of Info Justice
 

Kürzlich hochgeladen

Future Visions: Predictions to Guide and Time Tech Innovation, Peter Udo Diehl
Future Visions: Predictions to Guide and Time Tech Innovation, Peter Udo DiehlFuture Visions: Predictions to Guide and Time Tech Innovation, Peter Udo Diehl
Future Visions: Predictions to Guide and Time Tech Innovation, Peter Udo Diehl
Peter Udo Diehl
 

Kürzlich hochgeladen (20)

Speed Wins: From Kafka to APIs in Minutes
Speed Wins: From Kafka to APIs in MinutesSpeed Wins: From Kafka to APIs in Minutes
Speed Wins: From Kafka to APIs in Minutes
 
IoT Analytics Company Presentation May 2024
IoT Analytics Company Presentation May 2024IoT Analytics Company Presentation May 2024
IoT Analytics Company Presentation May 2024
 
Future Visions: Predictions to Guide and Time Tech Innovation, Peter Udo Diehl
Future Visions: Predictions to Guide and Time Tech Innovation, Peter Udo DiehlFuture Visions: Predictions to Guide and Time Tech Innovation, Peter Udo Diehl
Future Visions: Predictions to Guide and Time Tech Innovation, Peter Udo Diehl
 
Integrating Telephony Systems with Salesforce: Insights and Considerations, B...
Integrating Telephony Systems with Salesforce: Insights and Considerations, B...Integrating Telephony Systems with Salesforce: Insights and Considerations, B...
Integrating Telephony Systems with Salesforce: Insights and Considerations, B...
 
Designing for Hardware Accessibility at Comcast
Designing for Hardware Accessibility at ComcastDesigning for Hardware Accessibility at Comcast
Designing for Hardware Accessibility at Comcast
 
Enterprise Knowledge Graphs - Data Summit 2024
Enterprise Knowledge Graphs - Data Summit 2024Enterprise Knowledge Graphs - Data Summit 2024
Enterprise Knowledge Graphs - Data Summit 2024
 
The UX of Automation by AJ King, Senior UX Researcher, Ocado
The UX of Automation by AJ King, Senior UX Researcher, OcadoThe UX of Automation by AJ King, Senior UX Researcher, Ocado
The UX of Automation by AJ King, Senior UX Researcher, Ocado
 
Powerful Start- the Key to Project Success, Barbara Laskowska
Powerful Start- the Key to Project Success, Barbara LaskowskaPowerful Start- the Key to Project Success, Barbara Laskowska
Powerful Start- the Key to Project Success, Barbara Laskowska
 
AI revolution and Salesforce, Jiří Karpíšek
AI revolution and Salesforce, Jiří KarpíšekAI revolution and Salesforce, Jiří Karpíšek
AI revolution and Salesforce, Jiří Karpíšek
 
Custom Approval Process: A New Perspective, Pavel Hrbacek & Anindya Halder
Custom Approval Process: A New Perspective, Pavel Hrbacek & Anindya HalderCustom Approval Process: A New Perspective, Pavel Hrbacek & Anindya Halder
Custom Approval Process: A New Perspective, Pavel Hrbacek & Anindya Halder
 
Salesforce Adoption – Metrics, Methods, and Motivation, Antone Kom
Salesforce Adoption – Metrics, Methods, and Motivation, Antone KomSalesforce Adoption – Metrics, Methods, and Motivation, Antone Kom
Salesforce Adoption – Metrics, Methods, and Motivation, Antone Kom
 
Top 10 Symfony Development Companies 2024
Top 10 Symfony Development Companies 2024Top 10 Symfony Development Companies 2024
Top 10 Symfony Development Companies 2024
 
Connecting the Dots in Product Design at KAYAK
Connecting the Dots in Product Design at KAYAKConnecting the Dots in Product Design at KAYAK
Connecting the Dots in Product Design at KAYAK
 
Oauth 2.0 Introduction and Flows with MuleSoft
Oauth 2.0 Introduction and Flows with MuleSoftOauth 2.0 Introduction and Flows with MuleSoft
Oauth 2.0 Introduction and Flows with MuleSoft
 
WSO2CONMay2024OpenSourceConferenceDebrief.pptx
WSO2CONMay2024OpenSourceConferenceDebrief.pptxWSO2CONMay2024OpenSourceConferenceDebrief.pptx
WSO2CONMay2024OpenSourceConferenceDebrief.pptx
 
The Value of Certifying Products for FDO _ Paul at FIDO Alliance.pdf
The Value of Certifying Products for FDO _ Paul at FIDO Alliance.pdfThe Value of Certifying Products for FDO _ Paul at FIDO Alliance.pdf
The Value of Certifying Products for FDO _ Paul at FIDO Alliance.pdf
 
Choosing the Right FDO Deployment Model for Your Application _ Geoffrey at In...
Choosing the Right FDO Deployment Model for Your Application _ Geoffrey at In...Choosing the Right FDO Deployment Model for Your Application _ Geoffrey at In...
Choosing the Right FDO Deployment Model for Your Application _ Geoffrey at In...
 
How Red Hat Uses FDO in Device Lifecycle _ Costin and Vitaliy at Red Hat.pdf
How Red Hat Uses FDO in Device Lifecycle _ Costin and Vitaliy at Red Hat.pdfHow Red Hat Uses FDO in Device Lifecycle _ Costin and Vitaliy at Red Hat.pdf
How Red Hat Uses FDO in Device Lifecycle _ Costin and Vitaliy at Red Hat.pdf
 
Syngulon - Selection technology May 2024.pdf
Syngulon - Selection technology May 2024.pdfSyngulon - Selection technology May 2024.pdf
Syngulon - Selection technology May 2024.pdf
 
FDO for Camera, Sensor and Networking Device – Commercial Solutions from VinC...
FDO for Camera, Sensor and Networking Device – Commercial Solutions from VinC...FDO for Camera, Sensor and Networking Device – Commercial Solutions from VinC...
FDO for Camera, Sensor and Networking Device – Commercial Solutions from VinC...
 

Drupal Module Building (DrupalCon Paris)

  • 1. Make A Module A Practical Introduction to Module Development
  • 2. Matt Butcher Senior Programmer at Palantir.net, Author mbutcher on d.o http://twitter.com/technosophos http://technosophos.com
  • 4. Our Goal Build a Drupal module from scratch in 40 minutes or less.
  • 5. Our Module • One directory and two files. • Using Drupal’s hook system. • Add a new block that can be placed in one of the block regions. • Add a new “page” (menu callback).
  • 6. Begin with... • Module directory: paris/ • Two files: module_name.info • paris/paris.info module_name module_name.*.inc module_name.install • and others. paris/paris.module (optional) module_name.module
  • 7. The Info File • Contains information • Used by module system about a module to learn about the module • Plain text config file
  • 8. The Module File • Contains PHP code • Hook implementations live here • Often, other supporting code is here, too • Drupal loads this automatically
  • 9. Hooks Drupal looks for particular function patterns in module files. Functions that conform to these patterns are called “hook implementations”. http://www.flickr.com/photos/39321672@N07/3616749186/
  • 10. hook_block() • Use it to manage a block. • List • Display • Configure
  • 11. hook_menu() • Use it to register a URL pattern. • “Menu items”, in this case, are names that Drupal associates with functions.
  • 12. Learning More • API.Drupal.org • Handbooks on Drupal.org • Various books