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

Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Victor Rentea
 
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Victor Rentea
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
panagenda
 

Kürzlich hochgeladen (20)

ICT role in 21st century education and its challenges
ICT role in 21st century education and its challengesICT role in 21st century education and its challenges
ICT role in 21st century education and its challenges
 
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdfRising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
 
Introduction to Multilingual Retrieval Augmented Generation (RAG)
Introduction to Multilingual Retrieval Augmented Generation (RAG)Introduction to Multilingual Retrieval Augmented Generation (RAG)
Introduction to Multilingual Retrieval Augmented Generation (RAG)
 
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 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
 
MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024
 
Artificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyArtificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : Uncertainty
 
MS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectorsMS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectors
 
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
 
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
 
Platformless Horizons for Digital Adaptability
Platformless Horizons for Digital AdaptabilityPlatformless Horizons for Digital Adaptability
Platformless Horizons for Digital Adaptability
 
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
 
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
 
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
 
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWEREMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
 
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
 

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