SlideShare a Scribd company logo
1 of 33
Download to read offline
A Gentle Introduction


Addison Berry, Lullabot
DrupalCon, Washington, DC 2009
A lot of people get a bit overwhelmed by Drupal coding.
Sometimes that leads to running away or hacking.
Systems, Frameworks
               and APIs, Oh My!




API = set of functions that accomplish programming tasks - can be used “publicly”
Framework = basic app skeleton that solves common needs in a standardized way
CMS = features that help people build sites and manage content
Advantages: takes care of nasty, tedious stu; auth., security, etc. and its Open Source :)
Systems, Frameworks
               and APIs, Oh My!
                                        Content Management System
                                        built on the




API = set of functions that accomplish programming tasks - can be used “publicly”
Framework = basic app skeleton that solves common needs in a standardized way
CMS = features that help people build sites and manage content
Advantages: takes care of nasty, tedious stu; auth., security, etc. and its Open Source :)
Systems, Frameworks
               and APIs, Oh My!
                                        Content Management System
                                        built on the
                                        Framework,
                                        which uses the




API = set of functions that accomplish programming tasks - can be used “publicly”
Framework = basic app skeleton that solves common needs in a standardized way
CMS = features that help people build sites and manage content
Advantages: takes care of nasty, tedious stu; auth., security, etc. and its Open Source :)
Systems, Frameworks
               and APIs, Oh My!
                                        Content Management System
                                        built on the
                                        Framework,
                                        which uses the
                                        APIs
                                        (Application Programming
                                        Interface)

API = set of functions that accomplish programming tasks - can be used “publicly”
Framework = basic app skeleton that solves common needs in a standardized way
CMS = features that help people build sites and manage content
Advantages: takes care of nasty, tedious stu; auth., security, etc. and its Open Source :)
What is where?




CMS  framework  apis
Core modules and themes use the framework like everyone else.
Everyone should actually look at the files.
Includes folder holds the magic.
What is where?




CMS  framework  apis
Core modules and themes use the framework like everyone else.
Everyone should actually look at the files.
Includes folder holds the magic.
What is where?

                                                           base_path()
                                                           format_date()
                                                           l()
                                                           t()
                                                           url()




CMS  framework  apis
Core modules and themes use the framework like everyone else.
Everyone should actually look at the files.
Includes folder holds the magic.
Hooks

‣ Naming convention
  ‣ hook_* where hook is replaced
    by your module name
‣ Lets modules add their own stuff
  to Drupal’s workflow
A hook example

                                           Hey modules! I’m
                                           gonna display the
                                         permissions page, you
                                           have anything you
                                           want me to add?




Naming convention for functions that lets modules jump in to the Drupal workflow
hook_perm




Each module can respond by saying they have something.
If they don’t have anything, they just don’t use the hook.
blog_perm
                           I do!

                 blog




Each module can respond by saying they have something.
If they don’t have anything, they just don’t use the hook.
block_perm
                           I do!

                 blog




                            block

                                       me too

Each module can respond by saying they have something.
If they don’t have anything, they just don’t use the hook.
hook_perm
                           I do!

                 blog



                                                         blogapi
                            block                                  I don’t
                                       me too

Each module can respond by saying they have something.
If they don’t have anything, they just don’t use the hook.
Voila!




This is the display that gets made from hook_perm
The Train Analogy




•   The Node Train leaves the station with node/12 hitched
    It goes to the hook_nodeapi stop
    Attaches the taxonomy and comment cars
    Gets to the Theme depot
The Train Analogy




•   The Node Train leaves the station with node/12 hitched
    It goes to the hook_nodeapi stop
    Attaches the taxonomy and comment cars
    Gets to the Theme depot
The Train Analogy




•   The Node Train leaves the station with node/12 hitched
    It goes to the hook_nodeapi stop
    Attaches the taxonomy and comment cars
    Gets to the Theme depot
The Train Analogy




•   The Node Train leaves the station with node/12 hitched
    It goes to the hook_nodeapi stop
    Attaches the taxonomy and comment cars
    Gets to the Theme depot
Some major players
       Menu
       Form
       Database
       Theme
output: HTML, RSS
actions like: forwarding, login/logout
every internal link on a Drupal site is controlled by the menu system
Menu
                        ๏menu.inc != menu.module
                        ๏maps URLs to functions
                        ๏functions can display output
                           and initiate actions




output: HTML, RSS
actions like: forwarding, login/logout
every internal link on a Drupal site is controlled by the menu system
give it an array and it will give you the form
not just for devs. themers can control form output
give it an array and it will give you the form
not just for devs. themers can control form output
FAPI

                      • form.inc
                      • handles the form, validation
                         and submission




give it an array and it will give you the form
not just for devs. themers can control form output
dbs are not standardized for creation (schema)
built in security
Database

                         • database.inc (and
                            database*.inc)

                         • schema creation
                         • abstracted to work with
                            multiple databases


dbs are not standardized for creation (schema)
built in security
output is put through the theme system
many core theme elements are found in tpl files in the modules
Theme layer
             ✦theme.inc
             ✦system module has default tpls
                    block, box, page
                ✦

             ✦ other tpls are in the module folder



output is put through the theme system
many core theme elements are found in tpl files in the modules
Theme’s rule
they get a last crack at all output so the themer can change whatever they need
a function named mytheme_function_name will trump core and modules
✴Module output uses theme()
                       ✴Order of priority:
                          ✴ theme_function_name()
                          ✴ phptemplate_function_name()
                          ✴ mytheme_function_name()


Theme’s rule
they get a last crack at all output so the themer can change whatever they need
a function named mytheme_function_name will trump core and modules
Resources
Developer/Theme handbooks
Drupal source/api.drupal.org
Dev/Theme mailing lists (drupal.com/mailing-lists)
IRC: #drupal (#drupal-dev) #drupal-themes
Issue queues
Paper books: http://drupal.org/books

More Related Content

What's hot

Hanoi php day 2008 - 01.pham cong dinh - how.to.build.your.own.framework
Hanoi php day 2008 - 01.pham cong dinh - how.to.build.your.own.frameworkHanoi php day 2008 - 01.pham cong dinh - how.to.build.your.own.framework
Hanoi php day 2008 - 01.pham cong dinh - how.to.build.your.own.frameworkNguyen Duc Phu
 
<Head> Presentation: Plugging Into Wordpress
<Head> Presentation: Plugging Into Wordpress<Head> Presentation: Plugging Into Wordpress
<Head> Presentation: Plugging Into WordpressMatt Harris
 
Jsf2 composite-components
Jsf2 composite-componentsJsf2 composite-components
Jsf2 composite-componentsvinaysbk
 
Ajax Tags Advanced
Ajax Tags AdvancedAjax Tags Advanced
Ajax Tags AdvancedAkramWaseem
 
Zotonic presentation Erlang Camp Boston, august 2011
Zotonic presentation Erlang Camp Boston, august 2011Zotonic presentation Erlang Camp Boston, august 2011
Zotonic presentation Erlang Camp Boston, august 2011Arjan
 

What's hot (8)

Javascript Best Practices
Javascript Best PracticesJavascript Best Practices
Javascript Best Practices
 
Hanoi php day 2008 - 01.pham cong dinh - how.to.build.your.own.framework
Hanoi php day 2008 - 01.pham cong dinh - how.to.build.your.own.frameworkHanoi php day 2008 - 01.pham cong dinh - how.to.build.your.own.framework
Hanoi php day 2008 - 01.pham cong dinh - how.to.build.your.own.framework
 
Drupal Flyover, CMS Expo
Drupal Flyover, CMS ExpoDrupal Flyover, CMS Expo
Drupal Flyover, CMS Expo
 
<Head> Presentation: Plugging Into Wordpress
<Head> Presentation: Plugging Into Wordpress<Head> Presentation: Plugging Into Wordpress
<Head> Presentation: Plugging Into Wordpress
 
Ant User Guide
Ant User GuideAnt User Guide
Ant User Guide
 
Jsf2 composite-components
Jsf2 composite-componentsJsf2 composite-components
Jsf2 composite-components
 
Ajax Tags Advanced
Ajax Tags AdvancedAjax Tags Advanced
Ajax Tags Advanced
 
Zotonic presentation Erlang Camp Boston, august 2011
Zotonic presentation Erlang Camp Boston, august 2011Zotonic presentation Erlang Camp Boston, august 2011
Zotonic presentation Erlang Camp Boston, august 2011
 

Similar to Gentle Intro to Drupal Code

Architecture of Drupal - Drupal Camp
Architecture of Drupal - Drupal CampArchitecture of Drupal - Drupal Camp
Architecture of Drupal - Drupal CampDipen Chaudhary
 
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 2008Mir Nazim
 
Rapid site production with Drupal
Rapid site production with DrupalRapid site production with Drupal
Rapid site production with DrupalRob Sawyer
 
Drupal module development
Drupal module developmentDrupal module development
Drupal module developmentRachit Gupta
 
Drupal Best Practices
Drupal Best PracticesDrupal Best Practices
Drupal Best Practicesmanugoel2003
 
Patterns Drupal Camp Pune09
Patterns Drupal Camp Pune09Patterns Drupal Camp Pune09
Patterns Drupal Camp Pune09drupalindia
 
SynapseIndia drupal presentation on drupal best practices
SynapseIndia drupal  presentation on drupal best practicesSynapseIndia drupal  presentation on drupal best practices
SynapseIndia drupal presentation on drupal best practicesSynapseindiappsdevelopment
 
How to? Drupal developer toolkit. Dennis Povshedny.
How to? Drupal developer toolkit. Dennis Povshedny.How to? Drupal developer toolkit. Dennis Povshedny.
How to? Drupal developer toolkit. Dennis Povshedny.DrupalCampDN
 
Introduction To Drupal
Introduction To DrupalIntroduction To Drupal
Introduction To DrupalLauren Roth
 
The Drupal 7 Worst Practices Catalogue
The Drupal 7 Worst Practices CatalogueThe Drupal 7 Worst Practices Catalogue
The Drupal 7 Worst Practices CatalogueAlexandre Israël
 
Maven: Managing Software Projects for Repeatable Results
Maven: Managing Software Projects for Repeatable ResultsMaven: Managing Software Projects for Repeatable Results
Maven: Managing Software Projects for Repeatable ResultsSteve Keener
 
Drupal 8 - Core and API Changes
Drupal 8 - Core and API ChangesDrupal 8 - Core and API Changes
Drupal 8 - Core and API ChangesShabir Ahmad
 
Top 20 mistakes you will make on your 1st Drupal project
Top 20 mistakes you will make on your 1st Drupal projectTop 20 mistakes you will make on your 1st Drupal project
Top 20 mistakes you will make on your 1st Drupal projectIztok Smolic
 
Introduction And Basics of Modules in Drupal 7
Introduction And Basics of Modules in Drupal 7 Introduction And Basics of Modules in Drupal 7
Introduction And Basics of Modules in Drupal 7 Dhinakaran Mani
 

Similar to Gentle Intro to Drupal Code (20)

Drupal - Introduction to Drupal Creating Modules
Drupal - Introduction to Drupal Creating ModulesDrupal - Introduction to Drupal Creating Modules
Drupal - Introduction to Drupal Creating Modules
 
Drupal
DrupalDrupal
Drupal
 
Architecture of Drupal - Drupal Camp
Architecture of Drupal - Drupal CampArchitecture of Drupal - Drupal Camp
Architecture of Drupal - Drupal Camp
 
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
 
Rapid site production with Drupal
Rapid site production with DrupalRapid site production with Drupal
Rapid site production with Drupal
 
Drupal module development
Drupal module developmentDrupal module development
Drupal module development
 
Drupal Best Practices
Drupal Best PracticesDrupal Best Practices
Drupal Best Practices
 
Hacking core
Hacking coreHacking core
Hacking core
 
Aurelia intro
Aurelia introAurelia intro
Aurelia intro
 
Patterns Drupal Camp Pune09
Patterns Drupal Camp Pune09Patterns Drupal Camp Pune09
Patterns Drupal Camp Pune09
 
SynapseIndia drupal presentation on drupal best practices
SynapseIndia drupal  presentation on drupal best practicesSynapseIndia drupal  presentation on drupal best practices
SynapseIndia drupal presentation on drupal best practices
 
Entity cache
Entity cacheEntity cache
Entity cache
 
How to? Drupal developer toolkit. Dennis Povshedny.
How to? Drupal developer toolkit. Dennis Povshedny.How to? Drupal developer toolkit. Dennis Povshedny.
How to? Drupal developer toolkit. Dennis Povshedny.
 
Introduction To Drupal
Introduction To DrupalIntroduction To Drupal
Introduction To Drupal
 
The Drupal 7 Worst Practices Catalogue
The Drupal 7 Worst Practices CatalogueThe Drupal 7 Worst Practices Catalogue
The Drupal 7 Worst Practices Catalogue
 
Maven: Managing Software Projects for Repeatable Results
Maven: Managing Software Projects for Repeatable ResultsMaven: Managing Software Projects for Repeatable Results
Maven: Managing Software Projects for Repeatable Results
 
Drupal 8 - Core and API Changes
Drupal 8 - Core and API ChangesDrupal 8 - Core and API Changes
Drupal 8 - Core and API Changes
 
Top 20 mistakes you will make on your 1st Drupal project
Top 20 mistakes you will make on your 1st Drupal projectTop 20 mistakes you will make on your 1st Drupal project
Top 20 mistakes you will make on your 1st Drupal project
 
Introduction And Basics of Modules in Drupal 7
Introduction And Basics of Modules in Drupal 7 Introduction And Basics of Modules in Drupal 7
Introduction And Basics of Modules in Drupal 7
 
Drupal development
Drupal development Drupal development
Drupal development
 

More from Addison Berry

Gentle Intro to Drupal Code
Gentle Intro to Drupal CodeGentle Intro to Drupal Code
Gentle Intro to Drupal CodeAddison Berry
 
The Drupal Movement: where do you fit in?
The Drupal Movement: where do you fit in?The Drupal Movement: where do you fit in?
The Drupal Movement: where do you fit in?Addison Berry
 
Open Source Docs don't have to suck
Open Source Docs don't have to suckOpen Source Docs don't have to suck
Open Source Docs don't have to suckAddison Berry
 
Drupal Documentation (Argentina)
Drupal Documentation (Argentina)Drupal Documentation (Argentina)
Drupal Documentation (Argentina)Addison Berry
 
Documentation is Hot
Documentation is HotDocumentation is Hot
Documentation is HotAddison Berry
 
It's The People Stupid!
It's The People Stupid!It's The People Stupid!
It's The People Stupid!Addison Berry
 

More from Addison Berry (6)

Gentle Intro to Drupal Code
Gentle Intro to Drupal CodeGentle Intro to Drupal Code
Gentle Intro to Drupal Code
 
The Drupal Movement: where do you fit in?
The Drupal Movement: where do you fit in?The Drupal Movement: where do you fit in?
The Drupal Movement: where do you fit in?
 
Open Source Docs don't have to suck
Open Source Docs don't have to suckOpen Source Docs don't have to suck
Open Source Docs don't have to suck
 
Drupal Documentation (Argentina)
Drupal Documentation (Argentina)Drupal Documentation (Argentina)
Drupal Documentation (Argentina)
 
Documentation is Hot
Documentation is HotDocumentation is Hot
Documentation is Hot
 
It's The People Stupid!
It's The People Stupid!It's The People Stupid!
It's The People Stupid!
 

Recently uploaded

Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUnderstanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUK Journal
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptxHampshireHUG
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonetsnaman860154
 
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxFactors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxKatpro Technologies
 
A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?Igalia
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking MenDelhi Call girls
 
A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024Results
 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Enterprise Knowledge
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘RTylerCroy
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityPrincipled Technologies
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking MenDelhi Call girls
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Scriptwesley chun
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CVKhem
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slidespraypatel2
 
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...Martijn de Jong
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)Gabriella Davis
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreternaman860154
 
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...Neo4j
 
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 Processorsdebabhi2
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024The Digital Insurer
 

Recently uploaded (20)

Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUnderstanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonets
 
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxFactors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
 
A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men
 
A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024
 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivity
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CV
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slides
 
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...
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreter
 
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...
 
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
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 

Gentle Intro to Drupal Code

  • 1. A Gentle Introduction Addison Berry, Lullabot DrupalCon, Washington, DC 2009
  • 2. A lot of people get a bit overwhelmed by Drupal coding. Sometimes that leads to running away or hacking.
  • 3. Systems, Frameworks and APIs, Oh My! API = set of functions that accomplish programming tasks - can be used “publicly” Framework = basic app skeleton that solves common needs in a standardized way CMS = features that help people build sites and manage content Advantages: takes care of nasty, tedious stu; auth., security, etc. and its Open Source :)
  • 4. Systems, Frameworks and APIs, Oh My! Content Management System built on the API = set of functions that accomplish programming tasks - can be used “publicly” Framework = basic app skeleton that solves common needs in a standardized way CMS = features that help people build sites and manage content Advantages: takes care of nasty, tedious stu; auth., security, etc. and its Open Source :)
  • 5. Systems, Frameworks and APIs, Oh My! Content Management System built on the Framework, which uses the API = set of functions that accomplish programming tasks - can be used “publicly” Framework = basic app skeleton that solves common needs in a standardized way CMS = features that help people build sites and manage content Advantages: takes care of nasty, tedious stu; auth., security, etc. and its Open Source :)
  • 6. Systems, Frameworks and APIs, Oh My! Content Management System built on the Framework, which uses the APIs (Application Programming Interface) API = set of functions that accomplish programming tasks - can be used “publicly” Framework = basic app skeleton that solves common needs in a standardized way CMS = features that help people build sites and manage content Advantages: takes care of nasty, tedious stu; auth., security, etc. and its Open Source :)
  • 7. What is where? CMS framework apis Core modules and themes use the framework like everyone else. Everyone should actually look at the files. Includes folder holds the magic.
  • 8. What is where? CMS framework apis Core modules and themes use the framework like everyone else. Everyone should actually look at the files. Includes folder holds the magic.
  • 9. What is where? base_path() format_date() l() t() url() CMS framework apis Core modules and themes use the framework like everyone else. Everyone should actually look at the files. Includes folder holds the magic.
  • 10. Hooks ‣ Naming convention ‣ hook_* where hook is replaced by your module name ‣ Lets modules add their own stuff to Drupal’s workflow
  • 11. A hook example Hey modules! I’m gonna display the permissions page, you have anything you want me to add? Naming convention for functions that lets modules jump in to the Drupal workflow
  • 12. hook_perm Each module can respond by saying they have something. If they don’t have anything, they just don’t use the hook.
  • 13. blog_perm I do! blog Each module can respond by saying they have something. If they don’t have anything, they just don’t use the hook.
  • 14. block_perm I do! blog block me too Each module can respond by saying they have something. If they don’t have anything, they just don’t use the hook.
  • 15. hook_perm I do! blog blogapi block I don’t me too Each module can respond by saying they have something. If they don’t have anything, they just don’t use the hook.
  • 16. Voila! This is the display that gets made from hook_perm
  • 17. The Train Analogy • The Node Train leaves the station with node/12 hitched It goes to the hook_nodeapi stop Attaches the taxonomy and comment cars Gets to the Theme depot
  • 18. The Train Analogy • The Node Train leaves the station with node/12 hitched It goes to the hook_nodeapi stop Attaches the taxonomy and comment cars Gets to the Theme depot
  • 19. The Train Analogy • The Node Train leaves the station with node/12 hitched It goes to the hook_nodeapi stop Attaches the taxonomy and comment cars Gets to the Theme depot
  • 20. The Train Analogy • The Node Train leaves the station with node/12 hitched It goes to the hook_nodeapi stop Attaches the taxonomy and comment cars Gets to the Theme depot
  • 21. Some major players Menu Form Database Theme
  • 22. output: HTML, RSS actions like: forwarding, login/logout every internal link on a Drupal site is controlled by the menu system
  • 23. Menu ๏menu.inc != menu.module ๏maps URLs to functions ๏functions can display output and initiate actions output: HTML, RSS actions like: forwarding, login/logout every internal link on a Drupal site is controlled by the menu system
  • 24. give it an array and it will give you the form not just for devs. themers can control form output
  • 25. give it an array and it will give you the form not just for devs. themers can control form output
  • 26. FAPI • form.inc • handles the form, validation and submission give it an array and it will give you the form not just for devs. themers can control form output
  • 27. dbs are not standardized for creation (schema) built in security
  • 28. Database • database.inc (and database*.inc) • schema creation • abstracted to work with multiple databases dbs are not standardized for creation (schema) built in security
  • 29. output is put through the theme system many core theme elements are found in tpl files in the modules
  • 30. Theme layer ✦theme.inc ✦system module has default tpls block, box, page ✦ ✦ other tpls are in the module folder output is put through the theme system many core theme elements are found in tpl files in the modules
  • 31. Theme’s rule they get a last crack at all output so the themer can change whatever they need a function named mytheme_function_name will trump core and modules
  • 32. ✴Module output uses theme() ✴Order of priority: ✴ theme_function_name() ✴ phptemplate_function_name() ✴ mytheme_function_name() Theme’s rule they get a last crack at all output so the themer can change whatever they need a function named mytheme_function_name will trump core and modules
  • 33. Resources Developer/Theme handbooks Drupal source/api.drupal.org Dev/Theme mailing lists (drupal.com/mailing-lists) IRC: #drupal (#drupal-dev) #drupal-themes Issue queues Paper books: http://drupal.org/books