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

Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsMark Billinghurst
 
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc
 
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Mark Simos
 
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks..."LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...Fwdays
 
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
 
"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii SoldatenkoFwdays
 
Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!Manik S Magar
 
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024BookNet Canada
 
Streamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupStreamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupFlorian Wilhelm
 
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
 
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
 
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
 
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
 
WordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your BrandWordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your Brandgvaughan
 
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek SchlawackFwdays
 
"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr BaganFwdays
 
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdf
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdfHyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdf
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdfPrecisely
 
H2O.ai CEO/Founder: Sri Ambati Keynote at Wells Fargo Day
H2O.ai CEO/Founder: Sri Ambati Keynote at Wells Fargo DayH2O.ai CEO/Founder: Sri Ambati Keynote at Wells Fargo Day
H2O.ai CEO/Founder: Sri Ambati Keynote at Wells Fargo DaySri Ambati
 

Recently uploaded (20)

Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR Systems
 
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
 
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
 
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks..."LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
 
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
 
"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko
 
Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!
 
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
 
Streamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupStreamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project Setup
 
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
 
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
 
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
 
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
 
WordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your BrandWordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your Brand
 
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
 
"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan
 
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdf
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdfHyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdf
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdf
 
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptxE-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
 
H2O.ai CEO/Founder: Sri Ambati Keynote at Wells Fargo Day
H2O.ai CEO/Founder: Sri Ambati Keynote at Wells Fargo DayH2O.ai CEO/Founder: Sri Ambati Keynote at Wells Fargo Day
H2O.ai CEO/Founder: Sri Ambati Keynote at Wells Fargo Day
 

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