SlideShare une entreprise Scribd logo
1  sur  33
Télécharger pour lire hors ligne
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

Contenu connexe

Tendances

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
 

Tendances (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
 

Similaire à 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
 

Similaire à 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
 

Plus de 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
 

Plus de 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!
 

Dernier

Unraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfUnraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfAlex Barbosa Coqueiro
 
AI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsAI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsMemoori
 
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)Wonjun Hwang
 
DevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenDevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenHervé Boutemy
 
Gen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfGen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfAddepto
 
Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Scott Keck-Warren
 
SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024Lorenzo Miniero
 
Search Engine Optimization SEO PDF for 2024.pdf
Search Engine Optimization SEO PDF for 2024.pdfSearch Engine Optimization SEO PDF for 2024.pdf
Search Engine Optimization SEO PDF for 2024.pdfRankYa
 
Vector Databases 101 - An introduction to the world of Vector Databases
Vector Databases 101 - An introduction to the world of Vector DatabasesVector Databases 101 - An introduction to the world of Vector Databases
Vector Databases 101 - An introduction to the world of Vector DatabasesZilliz
 
DevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsDevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsSergiu Bodiu
 
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticsKotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticscarlostorres15106
 
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Patryk Bandurski
 
Scanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsScanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsRizwan Syed
 
Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Mattias Andersson
 
Artificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptxArtificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptxhariprasad279825
 
Unleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubUnleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubKalema Edgar
 
"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr BaganFwdays
 
Powerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time ClashPowerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time Clashcharlottematthew16
 
Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Enterprise Knowledge
 

Dernier (20)

Unraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfUnraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdf
 
AI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsAI as an Interface for Commercial Buildings
AI as an Interface for Commercial Buildings
 
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
 
DevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenDevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache Maven
 
Gen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfGen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdf
 
Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024
 
SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024
 
Search Engine Optimization SEO PDF for 2024.pdf
Search Engine Optimization SEO PDF for 2024.pdfSearch Engine Optimization SEO PDF for 2024.pdf
Search Engine Optimization SEO PDF for 2024.pdf
 
Vector Databases 101 - An introduction to the world of Vector Databases
Vector Databases 101 - An introduction to the world of Vector DatabasesVector Databases 101 - An introduction to the world of Vector Databases
Vector Databases 101 - An introduction to the world of Vector Databases
 
DevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsDevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platforms
 
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticsKotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
 
DMCC Future of Trade Web3 - Special Edition
DMCC Future of Trade Web3 - Special EditionDMCC Future of Trade Web3 - Special Edition
DMCC Future of Trade Web3 - Special Edition
 
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
 
Scanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsScanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL Certs
 
Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?
 
Artificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptxArtificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptx
 
Unleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubUnleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding Club
 
"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan
 
Powerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time ClashPowerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time Clash
 
Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 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