SlideShare a Scribd company logo
Default theme
implementations:
a guide for module developers
   who want sweet love from
     Morten and JohnAlbin
Who is this guy
and what the hell is he going
      to talk about?
JohnAlbin   (Wilkins)   Me and 19 other people wrote
                        50% of Drupal 7

 • Brief overview of the theme layer
 • Theme hook suggestions
 • Best practices for BYO Implementations
Separation of Concerns
Flow of Themed Content
A simplified wiring guide to the Theme Layer
Theme Hooks
        username
pager                             links
                   node

comment                   table
             page                         item_list


   theme(‘theme_hook_name’, $data)
BE LAZY!
 Pick an existing theme hook (if you can)

links                     file_link
image                     html_tag
image_style               more_link
item_list                 pager
username                  progress_bar
                          table
http://api.drupal.org/api/group/themeable/7
Laziness advntgs:
• Less work. (duh.)
 • Notemplate or theme function,
    no
        hook_theme(),

    no template_preprocess_HOOK(), etc.
  • Just: theme(‘hook’, $vars);
• Themersre-used. know how to style hooks
  that you
           already

• Instant integration with other modules!
Theme hook suggestions
(You, too, can be as awesome as Earl Miles.)



• theme(‘hook’, $vars);
• theme(‘hook__suggestion’, $vars); (D7 only)
• theme($suggestions_array, $vars);
Roll Your Own
• hook_theme() describes theme hooks
 • wtf_ftw()
 • define default variables
• Picking a theme function or a template
 • functions are faster
 • templates are easier
Separation of layers (again)

  • Data should be passed in as parameters
  • Display preprocess function
    in via a
             options should be params or pulled

  • Meta data should be modifiable by
    preprocess functions
Things that will make
      me angry
• Never, EVERa pull data
  from inside theme function
• If you have toitcall aa theme function!!! value,
  do NOT put in
                          function to get a

• Don’t be like D6’s theme_local_menus()
Avoid accidental 3-ways




 It’s likely you won’t get what you expect.
Provide context

• Meta data is just important to a themer
  as the actual data.
Mark-up and CSS
• Do your best.
• Less is more.
• Contextual CSS classes.
• Seek help.
 • Mark-up Marines: #drupal-design
Share the love!
What
did
you
think?
                  Step 1)
   Locate this session on the DCSF site

h.p://sf2010.drupal.org/conference/schedule

                   Step 2)
        Click the “Take Survey” link

More Related Content

What's hot (18)

PDF
Drupal 7 Theme System
Peter Arato
 
PDF
Wordcamp 2010
Bonnie Vasko
 
ODP
Twitter bootstrap and Drupal
Sujith Nara
 
PPT
Wordcamp 2010 Themes for Beginners
Bonnie Vasko
 
KEY
Grok Drupal (7) Theming (presented at DrupalCon San Francisco)
Laura Scott
 
PPTX
A look at Drupal 7 Theming
Aimee Maree
 
ODP
Yahoo! Search monkey API - CEBIT 2008
Eric D.
 
PPTX
Drupalcamp Atlanta 2010 Design-to-Theme
Mediacurrent
 
PPTX
Atlanta Drupal User Group (ADUG)
Mediacurrent
 
PDF
Drupal 8 theming deep dive
Romain Jarraud
 
PDF
Drupal8 themingdeepdive drupaldevdays-montpellier17042015
Romain Jarraud
 
PDF
Git Makes Me Angry Inside
Emma Jane Hogbin Westby
 
PPTX
WP Joburg Meetup 10: Genesis Framework by Trish Cornelius
WPJoburg
 
ODP
DrupalEasy: Intro to Theme Development
ultimike
 
PDF
Grok Drupal (7) Theming - 2011 Feb update
Laura Scott
 
KEY
WordPress Bootcamp Part 3 - Themes
Metronet
 
ODP
Drupal Theme Development - DrupalCon Chicago 2011
Ryan Price
 
PPT
WordCamp Miami 09 - WP Framework
Ptah Dunbar
 
Drupal 7 Theme System
Peter Arato
 
Wordcamp 2010
Bonnie Vasko
 
Twitter bootstrap and Drupal
Sujith Nara
 
Wordcamp 2010 Themes for Beginners
Bonnie Vasko
 
Grok Drupal (7) Theming (presented at DrupalCon San Francisco)
Laura Scott
 
A look at Drupal 7 Theming
Aimee Maree
 
Yahoo! Search monkey API - CEBIT 2008
Eric D.
 
Drupalcamp Atlanta 2010 Design-to-Theme
Mediacurrent
 
Atlanta Drupal User Group (ADUG)
Mediacurrent
 
Drupal 8 theming deep dive
Romain Jarraud
 
Drupal8 themingdeepdive drupaldevdays-montpellier17042015
Romain Jarraud
 
Git Makes Me Angry Inside
Emma Jane Hogbin Westby
 
WP Joburg Meetup 10: Genesis Framework by Trish Cornelius
WPJoburg
 
DrupalEasy: Intro to Theme Development
ultimike
 
Grok Drupal (7) Theming - 2011 Feb update
Laura Scott
 
WordPress Bootcamp Part 3 - Themes
Metronet
 
Drupal Theme Development - DrupalCon Chicago 2011
Ryan Price
 
WordCamp Miami 09 - WP Framework
Ptah Dunbar
 

Similar to Default theme implementations: a guide for module developers that want sweet love from Morten and JohnAlbin (20)

PPTX
Theming Drupal: Beyond the Look and Feel
Chris Albrecht
 
PPTX
Drupal Camp Porto - Developing with Drupal: First Steps
Luís Carneiro
 
PDF
Drupal theming - a practical approach (European Drupal Days 2015)
Eugenio Minardi
 
KEY
Advanced theming
tlattimore
 
KEY
Advanced theming
DrupalcampAtlanta2012
 
PPT
SynapseIndia drupal presentation on drupal best practices
Synapseindiappsdevelopment
 
PPT
Drupal - Introduction to Drupal Creating Modules
Vibrant Technologies & Computers
 
PDF
Drupal Front End PHP
Emma Jane Hogbin Westby
 
PDF
What's new in D7 Theming?
John Albin Wilkins
 
PPTX
Drupal Theming for Developers
Ian Carnaghan
 
ODP
Theming tips and tricks
aaroncouch
 
PDF
2007 Fsoss Drupal Under The Hood
James Walker
 
PDF
Design to Theme @ CMSExpo
Emma Jane Hogbin Westby
 
PDF
Nanocon Taiwan
John Albin Wilkins
 
PPTX
Theming Drupal 6 - An Introduction to the Basics
Erik Baldwin
 
PPT
Themer's roundtable
canarymason
 
PPTX
CalArts presentation
Ashok Modi
 
PDF
Drupal Flyover, CMS Expo
Emma Jane Hogbin Westby
 
PDF
Let's Zen! (Stop Theming From Scratch)
Chris Charlton
 
PDF
(some) Drupal Theming by Ryan Price
Ryan Price
 
Theming Drupal: Beyond the Look and Feel
Chris Albrecht
 
Drupal Camp Porto - Developing with Drupal: First Steps
Luís Carneiro
 
Drupal theming - a practical approach (European Drupal Days 2015)
Eugenio Minardi
 
Advanced theming
tlattimore
 
Advanced theming
DrupalcampAtlanta2012
 
SynapseIndia drupal presentation on drupal best practices
Synapseindiappsdevelopment
 
Drupal - Introduction to Drupal Creating Modules
Vibrant Technologies & Computers
 
Drupal Front End PHP
Emma Jane Hogbin Westby
 
What's new in D7 Theming?
John Albin Wilkins
 
Drupal Theming for Developers
Ian Carnaghan
 
Theming tips and tricks
aaroncouch
 
2007 Fsoss Drupal Under The Hood
James Walker
 
Design to Theme @ CMSExpo
Emma Jane Hogbin Westby
 
Nanocon Taiwan
John Albin Wilkins
 
Theming Drupal 6 - An Introduction to the Basics
Erik Baldwin
 
Themer's roundtable
canarymason
 
CalArts presentation
Ashok Modi
 
Drupal Flyover, CMS Expo
Emma Jane Hogbin Westby
 
Let's Zen! (Stop Theming From Scratch)
Chris Charlton
 
(some) Drupal Theming by Ryan Price
Ryan Price
 
Ad

More from John Albin Wilkins (19)

PDF
Using the CSS Nesting Spec Today
John Albin Wilkins
 
PDF
The Drupal Roadmap: From D7 to D9
John Albin Wilkins
 
PDF
Mastering Drupal 8’s Twig
John Albin Wilkins
 
PDF
CSS-in-JS: unexpected lessons for Drupal component design
John Albin Wilkins
 
PDF
Style Guide Driven Development: All Hail the Robot Overlords!
John Albin Wilkins
 
PDF
Styleguide-Driven Development: The New Web Development
John Albin Wilkins
 
PDF
Managing Complex Projects with Design Components - Drupalcon Austin 2014
John Albin Wilkins
 
PDF
DrupalSouth 2014: Managing Complex Projects with Design Components
John Albin Wilkins
 
PDF
SassConf: Managing Complex Projects with Design Components
John Albin Wilkins
 
PDF
Drupal Camp Taipei Keynote
John Albin Wilkins
 
PDF
Become an IA superstar (Chinese version)
John Albin Wilkins
 
PDF
Mobile drupal: building a mobile theme
John Albin Wilkins
 
KEY
Sass: CSS with Attitude
John Albin Wilkins
 
KEY
Mastering zen
John Albin Wilkins
 
PDF
Drupal and the Future of the Web
John Albin Wilkins
 
PDF
Rocking the Theme Layer
John Albin Wilkins
 
PDF
Drupal Design Tips
John Albin Wilkins
 
PDF
New Adventures in Drupal Theming
John Albin Wilkins
 
PPT
Making Drupal Dance: Techniques for Non-obvious Theme Manipulations
John Albin Wilkins
 
Using the CSS Nesting Spec Today
John Albin Wilkins
 
The Drupal Roadmap: From D7 to D9
John Albin Wilkins
 
Mastering Drupal 8’s Twig
John Albin Wilkins
 
CSS-in-JS: unexpected lessons for Drupal component design
John Albin Wilkins
 
Style Guide Driven Development: All Hail the Robot Overlords!
John Albin Wilkins
 
Styleguide-Driven Development: The New Web Development
John Albin Wilkins
 
Managing Complex Projects with Design Components - Drupalcon Austin 2014
John Albin Wilkins
 
DrupalSouth 2014: Managing Complex Projects with Design Components
John Albin Wilkins
 
SassConf: Managing Complex Projects with Design Components
John Albin Wilkins
 
Drupal Camp Taipei Keynote
John Albin Wilkins
 
Become an IA superstar (Chinese version)
John Albin Wilkins
 
Mobile drupal: building a mobile theme
John Albin Wilkins
 
Sass: CSS with Attitude
John Albin Wilkins
 
Mastering zen
John Albin Wilkins
 
Drupal and the Future of the Web
John Albin Wilkins
 
Rocking the Theme Layer
John Albin Wilkins
 
Drupal Design Tips
John Albin Wilkins
 
New Adventures in Drupal Theming
John Albin Wilkins
 
Making Drupal Dance: Techniques for Non-obvious Theme Manipulations
John Albin Wilkins
 
Ad

Recently uploaded (20)

PDF
Presentation - Vibe Coding The Future of Tech
yanuarsinggih1
 
PDF
"AI Transformation: Directions and Challenges", Pavlo Shaternik
Fwdays
 
PDF
LLMs.txt: Easily Control How AI Crawls Your Site
Keploy
 
PDF
From Code to Challenge: Crafting Skill-Based Games That Engage and Reward
aiyshauae
 
PDF
Chris Elwell Woburn, MA - Passionate About IT Innovation
Chris Elwell Woburn, MA
 
PDF
Fl Studio 24.2.2 Build 4597 Crack for Windows Free Download 2025
faizk77g
 
PDF
Empower Inclusion Through Accessible Java Applications
Ana-Maria Mihalceanu
 
PDF
HCIP-Data Center Facility Deployment V2.0 Training Material (Without Remarks ...
mcastillo49
 
PDF
HubSpot Main Hub: A Unified Growth Platform
Jaswinder Singh
 
PDF
Achieving Consistent and Reliable AI Code Generation - Medusa AI
medusaaico
 
PDF
"Beyond English: Navigating the Challenges of Building a Ukrainian-language R...
Fwdays
 
PDF
DevBcn - Building 10x Organizations Using Modern Productivity Metrics
Justin Reock
 
PPTX
Q2 FY26 Tableau User Group Leader Quarterly Call
lward7
 
PPTX
Building Search Using OpenSearch: Limitations and Workarounds
Sease
 
PDF
Building Real-Time Digital Twins with IBM Maximo & ArcGIS Indoors
Safe Software
 
PDF
Using FME to Develop Self-Service CAD Applications for a Major UK Police Force
Safe Software
 
PDF
Transcript: New from BookNet Canada for 2025: BNC BiblioShare - Tech Forum 2025
BookNet Canada
 
PDF
CIFDAQ Weekly Market Wrap for 11th July 2025
CIFDAQ
 
PDF
Reverse Engineering of Security Products: Developing an Advanced Microsoft De...
nwbxhhcyjv
 
PDF
Python basic programing language for automation
DanialHabibi2
 
Presentation - Vibe Coding The Future of Tech
yanuarsinggih1
 
"AI Transformation: Directions and Challenges", Pavlo Shaternik
Fwdays
 
LLMs.txt: Easily Control How AI Crawls Your Site
Keploy
 
From Code to Challenge: Crafting Skill-Based Games That Engage and Reward
aiyshauae
 
Chris Elwell Woburn, MA - Passionate About IT Innovation
Chris Elwell Woburn, MA
 
Fl Studio 24.2.2 Build 4597 Crack for Windows Free Download 2025
faizk77g
 
Empower Inclusion Through Accessible Java Applications
Ana-Maria Mihalceanu
 
HCIP-Data Center Facility Deployment V2.0 Training Material (Without Remarks ...
mcastillo49
 
HubSpot Main Hub: A Unified Growth Platform
Jaswinder Singh
 
Achieving Consistent and Reliable AI Code Generation - Medusa AI
medusaaico
 
"Beyond English: Navigating the Challenges of Building a Ukrainian-language R...
Fwdays
 
DevBcn - Building 10x Organizations Using Modern Productivity Metrics
Justin Reock
 
Q2 FY26 Tableau User Group Leader Quarterly Call
lward7
 
Building Search Using OpenSearch: Limitations and Workarounds
Sease
 
Building Real-Time Digital Twins with IBM Maximo & ArcGIS Indoors
Safe Software
 
Using FME to Develop Self-Service CAD Applications for a Major UK Police Force
Safe Software
 
Transcript: New from BookNet Canada for 2025: BNC BiblioShare - Tech Forum 2025
BookNet Canada
 
CIFDAQ Weekly Market Wrap for 11th July 2025
CIFDAQ
 
Reverse Engineering of Security Products: Developing an Advanced Microsoft De...
nwbxhhcyjv
 
Python basic programing language for automation
DanialHabibi2
 

Default theme implementations: a guide for module developers that want sweet love from Morten and JohnAlbin

  • 1. Default theme implementations: a guide for module developers who want sweet love from Morten and JohnAlbin
  • 2. Who is this guy and what the hell is he going to talk about? JohnAlbin (Wilkins) Me and 19 other people wrote 50% of Drupal 7 • Brief overview of the theme layer • Theme hook suggestions • Best practices for BYO Implementations
  • 4. Flow of Themed Content
  • 5. A simplified wiring guide to the Theme Layer
  • 6. Theme Hooks username pager links node comment table page item_list theme(‘theme_hook_name’, $data)
  • 7. BE LAZY! Pick an existing theme hook (if you can) links file_link image html_tag image_style more_link item_list pager username progress_bar table http://api.drupal.org/api/group/themeable/7
  • 8. Laziness advntgs: • Less work. (duh.) • Notemplate or theme function, no hook_theme(), no template_preprocess_HOOK(), etc. • Just: theme(‘hook’, $vars); • Themersre-used. know how to style hooks that you already • Instant integration with other modules!
  • 9. Theme hook suggestions (You, too, can be as awesome as Earl Miles.) • theme(‘hook’, $vars); • theme(‘hook__suggestion’, $vars); (D7 only) • theme($suggestions_array, $vars);
  • 10. Roll Your Own • hook_theme() describes theme hooks • wtf_ftw() • define default variables • Picking a theme function or a template • functions are faster • templates are easier
  • 11. Separation of layers (again) • Data should be passed in as parameters • Display preprocess function in via a options should be params or pulled • Meta data should be modifiable by preprocess functions
  • 12. Things that will make me angry • Never, EVERa pull data from inside theme function • If you have toitcall aa theme function!!! value, do NOT put in function to get a • Don’t be like D6’s theme_local_menus()
  • 13. Avoid accidental 3-ways It’s likely you won’t get what you expect.
  • 14. Provide context • Meta data is just important to a themer as the actual data.
  • 15. Mark-up and CSS • Do your best. • Less is more. • Contextual CSS classes. • Seek help. • Mark-up Marines: #drupal-design
  • 17. What
did
you
think? Step 1) Locate this session on the DCSF site 
h.p://sf2010.drupal.org/conference/schedule Step 2) Click the “Take Survey” link