SlideShare a Scribd company logo
BEGINNING MODULE DEVELOPMENT
Joe Crespo | Developer, Aten Design Group
Monday, July 1, 13
INTRODUCTIONS ARE IN ORDER
Desktop publishing >> Graphic design >> Web design >> PHP developer >> Drupal
Joe Crespo | Developer, Aten Design Group
Monday, July 1, 13
PART 1
“HELLO WORLD!”
Monday, July 1, 13
Drupal has its own set of vocabulary.
1. “Nodes,”“entities,” and “modules” have
specific meanings in Drupal that may
differ from what you think of as a
“node,” “entity,” or “module.”
Getting a handle on these concepts will
elevate your Drupal development skills.
ESSENTIALVOCABULARY
Terms to Know:
1. blocks
2. content types
3. entities
4. fields
5. hooks
6. nodes
7. taxonomy
8. themes
Beginning Module Development | Getting Started
Monday, July 1, 13
hook_form_alter()
Use your module to change an existing form.
drupal_add_css()
Add your own CSS file to add styles or amend
existing.
drupal_get_path()
Returns a path within the Drupal site structure.
DRUPAL FUNCTIONS
Beginning Module Development |The Context Module
Monday, July 1, 13
1. Adding new functionality to
Drupal means installing and
activating existing modules, or
creating new ones.
DRUPAL IS MODULAR
Beginning Module Development | Getting Started
Monday, July 1, 13
2. Modules communicate with one
another and manipulate data
through a series of hooks.
HOOKS
Beginning Module Development | Getting Started
Monday, July 1, 13
Hooks are functions automatically called
during execution.
Your module can make changes to content or
functionality by invoking these hooks.
HOOKS 2: ELECTRIC BOOGALOO
Beginning Module Development | Getting Started
For example:
Your Module Name: my_first_module
Drupal Hook:  hook_form_alter()
Module invokes Hook with my_first_module_form_alter()
Monday, July 1, 13
1. Drupal 7 is not object-oriented. While
Drupal does use objects, as its core,
Drupal is procedural. 
DRUPAL IS NOT DOWN WITH O.O.P.
Beginning Module Development | Getting Started
Monday, July 1, 13
2. Drupal loves enormous multidimensional arrays.
YOU DOWN WITH OOP?
Beginning Module Development | Getting Started
Monday, July 1, 13
PART 2
RULES OFTHUMB
Monday, July 1, 13
DRUPAL DEVELOPMENT PRINCIPLES
“Every time you hack core, God kills a kitten”
Beginning Module Development | Rules ofThumb
Monday, July 1, 13
DRUPAL DEVELOPMENT FUNDAMENTALS
1. Never add functionality to your
site by making changes to Drupal
core.
2. Avoid hacking contrib modules.
Beginning Module Development | Rules ofThumb
Monday, July 1, 13
Separate Drupal core modules, contrib modules, and your custom modules.
root directory
|__ modules <<< this is where core modules live – DO NOTTOUCH!
|__ sites
|__ all
    |__ modules
        |__ contrib <<< this is where the modules you download live
          |__ custom <<< this is where the modules you build live
ORGANIZINGYOUR SITE
Beginning Module Development | Rules ofThumb
Monday, July 1, 13
• Always keep in mind that the
module you are contemplating might
already exist.
• Search Drupal.org to see if the
module has already been built.
• If you don’t find an obvious answer,
ask on IRC.
BEFOREYOU START DEVELOPING A MODULE
Beginning Module Development | Rules ofThumb
Monday, July 1, 13
Clear the cache.
THE BEST DRUPALTIPYOU’LL EVER HEAR
Beginning Module Development | Rules ofThumb
That is all.
Monday, July 1, 13
PART 3
PUTTINGTHIS SESSION IN “CONTEXT”
Monday, July 1, 13
What Context does that’s pertinent to this session it that it allows site
builders to add blocks of content to regions of the page if certain
criteria are met.
For example:
You want to advertise free shipping, but only want to show that
message on your catalog index page at http://example.com/catalog.
You would create a block advertising free shipping and then set the
context to only show that block when the path is currently “catalog”
THE CONTEXT MODULE
Beginning Module Development |The Context Module
Monday, July 1, 13
DEMO
Monday, July 1, 13
CONCLUSION
WHAT HAVE WE LEARNED?
Monday, July 1, 13
What else can we do with
context_ui_extras?
This module solves one problem
with the UI, but maybe there are
ways to improve it?
1. More efficient:
hook_ form_ FORM_ID_alter()
2. Add a time condition to Context.
3. Make the Reactions draggable.
JUSTTHETIP OFTHE ICEBERG
Beginning Module Development | Now what?
Monday, July 1, 13
DRUPALTOOLBOX
Get to know these things: (if you don’t already)
1. Git: The version control software of choice for Drupal.
2. drush: A command line tool used for Drupal development.
3. devel: A really useful Drupal development module.
4. IRC: Internet Relay Chat and a helpful support tool used
throughout the community.
5. api.drupal.org is your new best friend.
Beginning Module Development |Toolbox
Monday, July 1, 13
BEGINNING MODULE DEVELOPMENT
Joe Crespo | Developer, Aten Design Group
Monday, July 1, 13

More Related Content

PDF
Stop Coding and Start Clicking - Pragmatic site building in Drupal
PDF
Wordpress Plugin Development Practices
PDF
PDF
There's a Module for That, MIMA Summit 2010
PDF
Made with drupal 8
PDF
Drupal for beginners - Global Training Days - Cebu 2016
PPT
Creating Your Media Blog
PDF
Drupal Global Training Day by Drupal Mumbai 6th Sep - Extending Drupal
Stop Coding and Start Clicking - Pragmatic site building in Drupal
Wordpress Plugin Development Practices
There's a Module for That, MIMA Summit 2010
Made with drupal 8
Drupal for beginners - Global Training Days - Cebu 2016
Creating Your Media Blog
Drupal Global Training Day by Drupal Mumbai 6th Sep - Extending Drupal

Viewers also liked (7)

PDF
Herd the CATS! Project management drupalcamp colorado 2013
PDF
Drupal 7 Development: Beginning Module Development
PDF
Old Dogs, New Tricks: Life After Launch
PDF
Case study for agile software development:
PPS
Core+Paths: A Design Framework for Findability, Prioritization and Value
PDF
Hype vs. Reality: The AI Explainer
PDF
Study: The Future of VR, AR and Self-Driving Cars
Herd the CATS! Project management drupalcamp colorado 2013
Drupal 7 Development: Beginning Module Development
Old Dogs, New Tricks: Life After Launch
Case study for agile software development:
Core+Paths: A Design Framework for Findability, Prioritization and Value
Hype vs. Reality: The AI Explainer
Study: The Future of VR, AR and Self-Driving Cars
Ad

Similar to Session v1 (20)

PDF
Dipping Your Toe into Drupal 8 Module Development
PPTX
Creating Drupal A Module
PPTX
Developing a drupal module
PPTX
Developing a Drupal module
PPTX
Drupal module development
PDF
Hello Drupal!
PDF
Introduction to Drupal Basics
PPTX
Introduction And Basics of Modules in Drupal 7
ODP
Custom module and theme development in Drupal7
PPTX
Ready. Set. Drupal! An Intro to Drupal 8, Part 2
PDF
Intro to Drupal Module Developement
PDF
Content Editing & Admin in Drupal 7
PPTX
Intro to Drupal Slides - DrupalCampSC 2014
PDF
Drupal Module Development - OSI Days 2010
PDF
Drupal Module Development
ODP
Intro to drupal module internals asheville
PDF
What is Drupal? And Why is it Useful? Webinar
PDF
Drupal Roadmap 2010
PDF
Drupal 8: A story of growing up and getting off the island
Dipping Your Toe into Drupal 8 Module Development
Creating Drupal A Module
Developing a drupal module
Developing a Drupal module
Drupal module development
Hello Drupal!
Introduction to Drupal Basics
Introduction And Basics of Modules in Drupal 7
Custom module and theme development in Drupal7
Ready. Set. Drupal! An Intro to Drupal 8, Part 2
Intro to Drupal Module Developement
Content Editing & Admin in Drupal 7
Intro to Drupal Slides - DrupalCampSC 2014
Drupal Module Development - OSI Days 2010
Drupal Module Development
Intro to drupal module internals asheville
What is Drupal? And Why is it Useful? Webinar
Drupal Roadmap 2010
Drupal 8: A story of growing up and getting off the island
Ad

Recently uploaded (20)

PPTX
Detection-First SIEM: Rule Types, Dashboards, and Threat-Informed Strategy
PDF
Per capita expenditure prediction using model stacking based on satellite ima...
PPTX
Cloud computing and distributed systems.
PPTX
Digital-Transformation-Roadmap-for-Companies.pptx
PPTX
MYSQL Presentation for SQL database connectivity
PPT
Teaching material agriculture food technology
PDF
Advanced methodologies resolving dimensionality complications for autism neur...
PDF
Approach and Philosophy of On baking technology
PDF
Blue Purple Modern Animated Computer Science Presentation.pdf.pdf
PDF
Encapsulation theory and applications.pdf
PDF
Agricultural_Statistics_at_a_Glance_2022_0.pdf
PPTX
KOM of Painting work and Equipment Insulation REV00 update 25-dec.pptx
PDF
MIND Revenue Release Quarter 2 2025 Press Release
PPTX
Spectroscopy.pptx food analysis technology
PDF
Spectral efficient network and resource selection model in 5G networks
PDF
Machine learning based COVID-19 study performance prediction
PDF
Peak of Data & AI Encore- AI for Metadata and Smarter Workflows
PDF
Chapter 3 Spatial Domain Image Processing.pdf
PPTX
Understanding_Digital_Forensics_Presentation.pptx
PPTX
Effective Security Operations Center (SOC) A Modern, Strategic, and Threat-In...
Detection-First SIEM: Rule Types, Dashboards, and Threat-Informed Strategy
Per capita expenditure prediction using model stacking based on satellite ima...
Cloud computing and distributed systems.
Digital-Transformation-Roadmap-for-Companies.pptx
MYSQL Presentation for SQL database connectivity
Teaching material agriculture food technology
Advanced methodologies resolving dimensionality complications for autism neur...
Approach and Philosophy of On baking technology
Blue Purple Modern Animated Computer Science Presentation.pdf.pdf
Encapsulation theory and applications.pdf
Agricultural_Statistics_at_a_Glance_2022_0.pdf
KOM of Painting work and Equipment Insulation REV00 update 25-dec.pptx
MIND Revenue Release Quarter 2 2025 Press Release
Spectroscopy.pptx food analysis technology
Spectral efficient network and resource selection model in 5G networks
Machine learning based COVID-19 study performance prediction
Peak of Data & AI Encore- AI for Metadata and Smarter Workflows
Chapter 3 Spatial Domain Image Processing.pdf
Understanding_Digital_Forensics_Presentation.pptx
Effective Security Operations Center (SOC) A Modern, Strategic, and Threat-In...

Session v1

  • 1. BEGINNING MODULE DEVELOPMENT Joe Crespo | Developer, Aten Design Group Monday, July 1, 13
  • 2. INTRODUCTIONS ARE IN ORDER Desktop publishing >> Graphic design >> Web design >> PHP developer >> Drupal Joe Crespo | Developer, Aten Design Group Monday, July 1, 13
  • 4. Drupal has its own set of vocabulary. 1. “Nodes,”“entities,” and “modules” have specific meanings in Drupal that may differ from what you think of as a “node,” “entity,” or “module.” Getting a handle on these concepts will elevate your Drupal development skills. ESSENTIALVOCABULARY Terms to Know: 1. blocks 2. content types 3. entities 4. fields 5. hooks 6. nodes 7. taxonomy 8. themes Beginning Module Development | Getting Started Monday, July 1, 13
  • 5. hook_form_alter() Use your module to change an existing form. drupal_add_css() Add your own CSS file to add styles or amend existing. drupal_get_path() Returns a path within the Drupal site structure. DRUPAL FUNCTIONS Beginning Module Development |The Context Module Monday, July 1, 13
  • 6. 1. Adding new functionality to Drupal means installing and activating existing modules, or creating new ones. DRUPAL IS MODULAR Beginning Module Development | Getting Started Monday, July 1, 13
  • 7. 2. Modules communicate with one another and manipulate data through a series of hooks. HOOKS Beginning Module Development | Getting Started Monday, July 1, 13
  • 8. Hooks are functions automatically called during execution. Your module can make changes to content or functionality by invoking these hooks. HOOKS 2: ELECTRIC BOOGALOO Beginning Module Development | Getting Started For example: Your Module Name: my_first_module Drupal Hook:  hook_form_alter() Module invokes Hook with my_first_module_form_alter() Monday, July 1, 13
  • 9. 1. Drupal 7 is not object-oriented. While Drupal does use objects, as its core, Drupal is procedural.  DRUPAL IS NOT DOWN WITH O.O.P. Beginning Module Development | Getting Started Monday, July 1, 13
  • 10. 2. Drupal loves enormous multidimensional arrays. YOU DOWN WITH OOP? Beginning Module Development | Getting Started Monday, July 1, 13
  • 12. DRUPAL DEVELOPMENT PRINCIPLES “Every time you hack core, God kills a kitten” Beginning Module Development | Rules ofThumb Monday, July 1, 13
  • 13. DRUPAL DEVELOPMENT FUNDAMENTALS 1. Never add functionality to your site by making changes to Drupal core. 2. Avoid hacking contrib modules. Beginning Module Development | Rules ofThumb Monday, July 1, 13
  • 14. Separate Drupal core modules, contrib modules, and your custom modules. root directory |__ modules <<< this is where core modules live – DO NOTTOUCH! |__ sites |__ all     |__ modules         |__ contrib <<< this is where the modules you download live           |__ custom <<< this is where the modules you build live ORGANIZINGYOUR SITE Beginning Module Development | Rules ofThumb Monday, July 1, 13
  • 15. • Always keep in mind that the module you are contemplating might already exist. • Search Drupal.org to see if the module has already been built. • If you don’t find an obvious answer, ask on IRC. BEFOREYOU START DEVELOPING A MODULE Beginning Module Development | Rules ofThumb Monday, July 1, 13
  • 16. Clear the cache. THE BEST DRUPALTIPYOU’LL EVER HEAR Beginning Module Development | Rules ofThumb That is all. Monday, July 1, 13
  • 17. PART 3 PUTTINGTHIS SESSION IN “CONTEXT” Monday, July 1, 13
  • 18. What Context does that’s pertinent to this session it that it allows site builders to add blocks of content to regions of the page if certain criteria are met. For example: You want to advertise free shipping, but only want to show that message on your catalog index page at http://example.com/catalog. You would create a block advertising free shipping and then set the context to only show that block when the path is currently “catalog” THE CONTEXT MODULE Beginning Module Development |The Context Module Monday, July 1, 13
  • 20. CONCLUSION WHAT HAVE WE LEARNED? Monday, July 1, 13
  • 21. What else can we do with context_ui_extras? This module solves one problem with the UI, but maybe there are ways to improve it? 1. More efficient: hook_ form_ FORM_ID_alter() 2. Add a time condition to Context. 3. Make the Reactions draggable. JUSTTHETIP OFTHE ICEBERG Beginning Module Development | Now what? Monday, July 1, 13
  • 22. DRUPALTOOLBOX Get to know these things: (if you don’t already) 1. Git: The version control software of choice for Drupal. 2. drush: A command line tool used for Drupal development. 3. devel: A really useful Drupal development module. 4. IRC: Internet Relay Chat and a helpful support tool used throughout the community. 5. api.drupal.org is your new best friend. Beginning Module Development |Toolbox Monday, July 1, 13
  • 23. BEGINNING MODULE DEVELOPMENT Joe Crespo | Developer, Aten Design Group Monday, July 1, 13