SlideShare a Scribd company logo
Sherlock Markup and Sammy
Semantic


Name:       Andreas Sahle
drupal.org: pixelmord
twitter:    @pixelmord
Drupal Theming - Forensic
         analysis
Personas
                   „To be a good detective,
                   you have to think like a
                   criminal.”

„I‘d rather be a
gangster than a
criminal”
vs


A criminal is a gangster that got
            cought...
For a crime there is always

means, motive and
  opportunity
Motive
  the reason the defendant had
  to commit the crime

• Remove Markup / Hide stuff
• Change the markup
• Add JS/CSS files
• Alter the data
Hide something
configuration: hidden

             preprocess:
 [..][class][] = .element-invisible;
                                           display : none;

                     tpl: hide();


                                   Form API: #access
                                  Render API: unset ();
  .element-invisible
Opportunity

  whether or not the defendant
  had the chance to commit the
  crime

• configuration
• theme
• the APIs + hook_XXX_alter
Opportunity:
Configuration
Opportunity:
      Configuration



• theme configuration
• Fields UI / view mode
• node/comment configuration
• views/views field configuration
Opportunity:   Theme
Opportunity:     Theme


• preprocessing
• templates
• theme functions
• (hook_XXX_alter)
Opportunity:     Theme


• preprocessing
• templates
• theme functions
• (hook_XXX_alter)
Opportunity:    The APIs



• Field API
• Form API
• Render API
• hook_XXX_alter
Forensic analysis
• Firebug
• Theme developer
• Study similar crimes
              • Devel module
              • Search and inspect plus
                 RTFM

              • Study the master plan
Theme Developer




• Heads Up Display
• Inspect elements on site
• drupal.org/project/devel_themer
Similar crimes




• study ZEN and other base themes
check out the
 master plan


   • DEVEL the hell out of it
   • variables and Form/Render
     API

   • theme registry
dpm(‘everything‘);
Search, inspect, RTFM
• hook_theme();
• theme_function();
• XXX.tpl.php
• http://drupal.org/node/
  173880#theming-
  overrides
theme function call for Drupal 6.x
theme('hook', $arguments)                                                    http://api.drupal.org/api/function/theme/6


           [ load theme registry ]
           [ check hook for *wild cards ]

                 if hook is function

                             f.a themeName_hook($arguments)                   template.php
                                                                        or
                             f.b engineName_hook($arguments)                  .engine

                             f.c theme_hook($arguments)                 .module/.inc
                              [ default implementation as function ]


                         else hook is template

                                         [ convert $arguments into variables ]
                                         [ check for render function, defaults to theme_render_template ]
                                         [ check for extension function and run, defaults to ".tpl.php" ]
    preprocess functions
                                           template_preprocess                 theme.inc
                                                                                                              t.a
[ set variables & suggestions ]            template_preprocess_hook                .module/.inc

                                           moduleName_preprocess                        .module
 All variables passed by reference         moduleName_preprocess_hook                                         t.b
 between each preprocess function.
 As a result, variables are additive       engineName_engine_preprocess                           .engine
 building the variables array.
                                           engineName_engine_preprocess_hook                                  t.c

                                           engineName_preprocess                          template.php
                                           engineName_preprocess_hook                                         t.d
                                           themeName_preprocess
                                           themeName_preprocess_hook


                                         [ collect suggestions ]

                                           drupal_discover_template
                                           [ find implemented suggestion ]


                                           theme_render_template


                                            [ assemble .tpl.php file ]


        suggestion                       default hook


suggestion.tpl.php                         hook.tpl.php
 <html>                                     <html>
  <?php print $variable ?>                   <?php print $variable ?>
 </html>                                    </html>
Choose your weapon right,
Choose your weapon right,
theme function?

 
 
 
 
 
 
 
 
 
 
 
 template?
theme function?

 
 
 
 
 
 
 
 
 
 
 
 template?



   • theme function is faster
   • template is (pre)processed
Preprocessing




• gangstatheme_preprocess_block
• gangstatheme_preprocess_node
The second bullet




 • gangstatheme_process_page
„The onion
        analogy“
• Markup wraps data like an onion.



• The onion skins are produced in the
  different stages of the Drupal
  themeing process.
„The onion
        analogy“
• Markup wraps data like an onion.



• The onion skins are produced in the
  different stages of the Drupal
  themeing process.
Theming a field
Sherlock Markup and Sammy Semantic - drupal theming forensic analysis
Sherlock Markup and Sammy Semantic - drupal theming forensic analysis
Theming a block
#attached
Theming a form element
Sherlock Markup and Sammy Semantic - drupal theming forensic analysis
views theming




configure everything   /   flexible templates
Theming a field view
Thank you!

Name:       Andreas Sahle
drupal.org: pixelmord
twitter:    @pixelmord
image credits
 http://www.flickr.com/photos/nullvalue/4188517246/in/      http://www.flickr.com/photos/urban-spaceman/4311168437/in/
     gallery-31964157@N00-72157626883338113/                       gallery-31964157@N00-72157626883338113/


  http://www.flickr.com/photos/gregwake/209493486/in/
      gallery-31964157@N00-72157626883338113/               http://www.flickr.com/photos/dunechaser/2937238366/in/
                                                                  gallery-31964157@N00-72157626883338113/


 http://www.flickr.com/photos/ddalledo/807012017/in/          http://www.flickr.com/photos/elbragon/5455939124/in/
    gallery-31964157@N00-72157626883338113/                      gallery-31964157@N00-72157626883338113/


                                                           http://www.flickr.com/photos/mrcrash/823113691/in/
http://www.flickr.com/photos/mskogly/2405945004/               gallery-31964157@N00-72157626883338113/
 in/gallery-31964157@N00-72157626883338113/

                                                          http://www.flickr.com/photos/wondering_gypsy/3329497063/in/
                                                                  gallery-31964157@N00-72157626883338113/
 http://www.flickr.com/photos/johnmcnab/5499490056/
    in/gallery-31964157@N00-72157626883338113/
                                                             http://www.flickr.com/photos/geojanitor/2432843590/in/
                                                                  gallery-31964157@N00-72157626883338113/

http://www.flickr.com/photos/skimaskdude/4379613766/in/
       gallery-31964157@N00-72157626883338113/             http://www.flickr.com/photos/13218517@N00/3338928294/in/
                                                                   gallery-31964157@N00-72157627028472076/

http://www.flickr.com/photos/leonardlow/4337973246/in/
      gallery-31964157@N00-72157627028472076/
                                                            http://www.flickr.com/photos/bricknave/4419270183/in/
                                                                 gallery-31964157@N00-72157627028472076/
  http://www.flickr.com/photos/ben_lawson/2039198622/in/
        gallery-31964157@N00-72157627028472076/
                                                          http://www.flickr.com/photos/21232564@N06/2234726613/in/
                                                                  gallery-31964157@N00-72157627028472076/
   http://www.flickr.com/photos/wscullin/3770015991/in/
       gallery-31964157@N00-72157626883338113/
                                                           http://www.flickr.com/photos/dvdmerwe/5111063582/in/
                                                                gallery-31964157@N00-72157627028472076/
   http://www.flickr.com/photos/auntiep/17135231/in/
     gallery-31964157@N00-72157627028472076/

More Related Content

PDF
Moving from Django Apps to Services
PPT
Render API - Pavel Makhrinsky
KEY
jQuery Plugin Creation
PDF
Image Manipulation in WordPress 3.5 - WordCamp Phoenix 2013
PDF
Plugin jQuery, Design Patterns
PDF
Django Heresies
PDF
Best Practices in Plugin Development (WordCamp Seattle)
PPT
jQuery and_drupal
Moving from Django Apps to Services
Render API - Pavel Makhrinsky
jQuery Plugin Creation
Image Manipulation in WordPress 3.5 - WordCamp Phoenix 2013
Plugin jQuery, Design Patterns
Django Heresies
Best Practices in Plugin Development (WordCamp Seattle)
jQuery and_drupal

What's hot (20)

PDF
A New Baseline for Front-End Devs
PDF
Mulberry: A Mobile App Development Toolkit
PPTX
Magento Live Australia 2016: Request Flow
PPT
Building Robust jQuery Plugins
PDF
Hooks WCSD12
PPT
Drupal Javascript for developers
PDF
Image manipulation in WordPress 3.5
PDF
Modular and Event-Driven JavaScript
PDF
Arquitetura de Front-end em Aplicações de Larga Escala
PDF
WCLV13 JavaScript
PDF
Celix universal OSGi
PDF
Making Sense of Twig
PPTX
jQuery PPT
PPT
Phase2 OpenPublish Presentation SF SemWeb Meetup, April 28, 2009
PDF
Dojo Confessions
PDF
Intro to Ember.js
PDF
jQuery Loves Developers - Oredev 2009
PDF
Curso Symfony - Clase 2
PPTX
Maintainable JavaScript 2012
PDF
Curso Symfony - Clase 4
A New Baseline for Front-End Devs
Mulberry: A Mobile App Development Toolkit
Magento Live Australia 2016: Request Flow
Building Robust jQuery Plugins
Hooks WCSD12
Drupal Javascript for developers
Image manipulation in WordPress 3.5
Modular and Event-Driven JavaScript
Arquitetura de Front-end em Aplicações de Larga Escala
WCLV13 JavaScript
Celix universal OSGi
Making Sense of Twig
jQuery PPT
Phase2 OpenPublish Presentation SF SemWeb Meetup, April 28, 2009
Dojo Confessions
Intro to Ember.js
jQuery Loves Developers - Oredev 2009
Curso Symfony - Clase 2
Maintainable JavaScript 2012
Curso Symfony - Clase 4
Ad

Viewers also liked (8)

PPTX
Marky Markup and the Funky Bunch
PDF
Optimizing Drupal 7 HTML Markup - Using Panels, Page Manager, and Fences to P...
PPT
Drupal Presentation @ the Higher Education Web Symposium
KEY
Semantic Site Building (Drupal 7)
PDF
Breaking the Box: Pushing the Boundaries of UX with Drupal
PPT
What Is Force
PDF
BEM it!
PDF
Bootstrap Framework and Drupal
Marky Markup and the Funky Bunch
Optimizing Drupal 7 HTML Markup - Using Panels, Page Manager, and Fences to P...
Drupal Presentation @ the Higher Education Web Symposium
Semantic Site Building (Drupal 7)
Breaking the Box: Pushing the Boundaries of UX with Drupal
What Is Force
BEM it!
Bootstrap Framework and Drupal
Ad

Similar to Sherlock Markup and Sammy Semantic - drupal theming forensic analysis (20)

PDF
Drupal Front End PHP
PDF
Drupal 7 Theming - Behind the scenes
PDF
Forensic Theming - DrupalCon London
PDF
Learning PHP for Drupal Theming, DC Chicago 2009
PDF
Functional FIPS: Learning PHP for Drupal Theming
PDF
Design to Theme @ CMSExpo
PDF
Drupal Flyover, CMS Expo
PDF
Forensic Theming for Drupal
KEY
Advanced theming
KEY
Advanced theming
PDF
Drupal Theming An Introduction
PDF
Introduction to Drupal (7) Theming
PPTX
Theming Drupal 6 - An Introduction to the Basics
PDF
There's a Module for That, MIMA Summit 2010
PDF
Atomicant Drupal 6 Theming
ODP
Drupal Theme Development - DrupalCon Chicago 2011
ODP
DrupalEasy: Intro to Theme Development
PPTX
Drupal Camp Porto - Developing with Drupal: First Steps
PDF
Intro to Theming Drupal, FOSSLC Summer Camp 2010
KEY
Grok Drupal (7) Theming (presented at DrupalCon San Francisco)
Drupal Front End PHP
Drupal 7 Theming - Behind the scenes
Forensic Theming - DrupalCon London
Learning PHP for Drupal Theming, DC Chicago 2009
Functional FIPS: Learning PHP for Drupal Theming
Design to Theme @ CMSExpo
Drupal Flyover, CMS Expo
Forensic Theming for Drupal
Advanced theming
Advanced theming
Drupal Theming An Introduction
Introduction to Drupal (7) Theming
Theming Drupal 6 - An Introduction to the Basics
There's a Module for That, MIMA Summit 2010
Atomicant Drupal 6 Theming
Drupal Theme Development - DrupalCon Chicago 2011
DrupalEasy: Intro to Theme Development
Drupal Camp Porto - Developing with Drupal: First Steps
Intro to Theming Drupal, FOSSLC Summer Camp 2010
Grok Drupal (7) Theming (presented at DrupalCon San Francisco)

Recently uploaded (20)

PPTX
Detection-First SIEM: Rule Types, Dashboards, and Threat-Informed Strategy
PPTX
20250228 LYD VKU AI Blended-Learning.pptx
PDF
Encapsulation_ Review paper, used for researhc scholars
PDF
Reach Out and Touch Someone: Haptics and Empathic Computing
PDF
Building Integrated photovoltaic BIPV_UPV.pdf
PDF
Network Security Unit 5.pdf for BCA BBA.
PDF
Architecting across the Boundaries of two Complex Domains - Healthcare & Tech...
PPTX
MYSQL Presentation for SQL database connectivity
PDF
Blue Purple Modern Animated Computer Science Presentation.pdf.pdf
PPTX
Understanding_Digital_Forensics_Presentation.pptx
PPTX
Effective Security Operations Center (SOC) A Modern, Strategic, and Threat-In...
DOCX
The AUB Centre for AI in Media Proposal.docx
PDF
Advanced methodologies resolving dimensionality complications for autism neur...
PPTX
sap open course for s4hana steps from ECC to s4
PDF
Diabetes mellitus diagnosis method based random forest with bat algorithm
PDF
Electronic commerce courselecture one. Pdf
PPTX
VMware vSphere Foundation How to Sell Presentation-Ver1.4-2-14-2024.pptx
PDF
Mobile App Security Testing_ A Comprehensive Guide.pdf
PDF
TokAI - TikTok AI Agent : The First AI Application That Analyzes 10,000+ Vira...
PDF
The Rise and Fall of 3GPP – Time for a Sabbatical?
Detection-First SIEM: Rule Types, Dashboards, and Threat-Informed Strategy
20250228 LYD VKU AI Blended-Learning.pptx
Encapsulation_ Review paper, used for researhc scholars
Reach Out and Touch Someone: Haptics and Empathic Computing
Building Integrated photovoltaic BIPV_UPV.pdf
Network Security Unit 5.pdf for BCA BBA.
Architecting across the Boundaries of two Complex Domains - Healthcare & Tech...
MYSQL Presentation for SQL database connectivity
Blue Purple Modern Animated Computer Science Presentation.pdf.pdf
Understanding_Digital_Forensics_Presentation.pptx
Effective Security Operations Center (SOC) A Modern, Strategic, and Threat-In...
The AUB Centre for AI in Media Proposal.docx
Advanced methodologies resolving dimensionality complications for autism neur...
sap open course for s4hana steps from ECC to s4
Diabetes mellitus diagnosis method based random forest with bat algorithm
Electronic commerce courselecture one. Pdf
VMware vSphere Foundation How to Sell Presentation-Ver1.4-2-14-2024.pptx
Mobile App Security Testing_ A Comprehensive Guide.pdf
TokAI - TikTok AI Agent : The First AI Application That Analyzes 10,000+ Vira...
The Rise and Fall of 3GPP – Time for a Sabbatical?

Sherlock Markup and Sammy Semantic - drupal theming forensic analysis

  • 1. Sherlock Markup and Sammy Semantic Name: Andreas Sahle drupal.org: pixelmord twitter: @pixelmord
  • 2. Drupal Theming - Forensic analysis
  • 3. Personas „To be a good detective, you have to think like a criminal.” „I‘d rather be a gangster than a criminal”
  • 4. vs A criminal is a gangster that got cought...
  • 5. For a crime there is always means, motive and opportunity
  • 6. Motive the reason the defendant had to commit the crime • Remove Markup / Hide stuff • Change the markup • Add JS/CSS files • Alter the data
  • 8. configuration: hidden preprocess: [..][class][] = .element-invisible; display : none; tpl: hide(); Form API: #access Render API: unset (); .element-invisible
  • 9. Opportunity whether or not the defendant had the chance to commit the crime • configuration • theme • the APIs + hook_XXX_alter
  • 11. Opportunity: Configuration • theme configuration • Fields UI / view mode • node/comment configuration • views/views field configuration
  • 12. Opportunity: Theme
  • 13. Opportunity: Theme • preprocessing • templates • theme functions • (hook_XXX_alter)
  • 14. Opportunity: Theme • preprocessing • templates • theme functions • (hook_XXX_alter)
  • 15. Opportunity: The APIs • Field API • Form API • Render API • hook_XXX_alter
  • 16. Forensic analysis • Firebug • Theme developer • Study similar crimes • Devel module • Search and inspect plus RTFM • Study the master plan
  • 17. Theme Developer • Heads Up Display • Inspect elements on site • drupal.org/project/devel_themer
  • 18. Similar crimes • study ZEN and other base themes
  • 19. check out the master plan • DEVEL the hell out of it • variables and Form/Render API • theme registry
  • 21. Search, inspect, RTFM • hook_theme(); • theme_function(); • XXX.tpl.php • http://drupal.org/node/ 173880#theming- overrides
  • 22. theme function call for Drupal 6.x theme('hook', $arguments) http://api.drupal.org/api/function/theme/6 [ load theme registry ] [ check hook for *wild cards ] if hook is function f.a themeName_hook($arguments) template.php or f.b engineName_hook($arguments) .engine f.c theme_hook($arguments) .module/.inc [ default implementation as function ] else hook is template [ convert $arguments into variables ] [ check for render function, defaults to theme_render_template ] [ check for extension function and run, defaults to ".tpl.php" ] preprocess functions template_preprocess theme.inc t.a [ set variables & suggestions ] template_preprocess_hook .module/.inc moduleName_preprocess .module All variables passed by reference moduleName_preprocess_hook t.b between each preprocess function. As a result, variables are additive engineName_engine_preprocess .engine building the variables array. engineName_engine_preprocess_hook t.c engineName_preprocess template.php engineName_preprocess_hook t.d themeName_preprocess themeName_preprocess_hook [ collect suggestions ] drupal_discover_template [ find implemented suggestion ] theme_render_template [ assemble .tpl.php file ] suggestion default hook suggestion.tpl.php hook.tpl.php <html> <html> <?php print $variable ?> <?php print $variable ?> </html> </html>
  • 25. theme function? template?
  • 26. theme function? template? • theme function is faster • template is (pre)processed
  • 28. The second bullet • gangstatheme_process_page
  • 29. „The onion analogy“ • Markup wraps data like an onion. • The onion skins are produced in the different stages of the Drupal themeing process.
  • 30. „The onion analogy“ • Markup wraps data like an onion. • The onion skins are produced in the different stages of the Drupal themeing process.
  • 36. Theming a form element
  • 38. views theming configure everything / flexible templates
  • 40. Thank you! Name: Andreas Sahle drupal.org: pixelmord twitter: @pixelmord
  • 41. image credits http://www.flickr.com/photos/nullvalue/4188517246/in/ http://www.flickr.com/photos/urban-spaceman/4311168437/in/ gallery-31964157@N00-72157626883338113/ gallery-31964157@N00-72157626883338113/ http://www.flickr.com/photos/gregwake/209493486/in/ gallery-31964157@N00-72157626883338113/ http://www.flickr.com/photos/dunechaser/2937238366/in/ gallery-31964157@N00-72157626883338113/ http://www.flickr.com/photos/ddalledo/807012017/in/ http://www.flickr.com/photos/elbragon/5455939124/in/ gallery-31964157@N00-72157626883338113/ gallery-31964157@N00-72157626883338113/ http://www.flickr.com/photos/mrcrash/823113691/in/ http://www.flickr.com/photos/mskogly/2405945004/ gallery-31964157@N00-72157626883338113/ in/gallery-31964157@N00-72157626883338113/ http://www.flickr.com/photos/wondering_gypsy/3329497063/in/ gallery-31964157@N00-72157626883338113/ http://www.flickr.com/photos/johnmcnab/5499490056/ in/gallery-31964157@N00-72157626883338113/ http://www.flickr.com/photos/geojanitor/2432843590/in/ gallery-31964157@N00-72157626883338113/ http://www.flickr.com/photos/skimaskdude/4379613766/in/ gallery-31964157@N00-72157626883338113/ http://www.flickr.com/photos/13218517@N00/3338928294/in/ gallery-31964157@N00-72157627028472076/ http://www.flickr.com/photos/leonardlow/4337973246/in/ gallery-31964157@N00-72157627028472076/ http://www.flickr.com/photos/bricknave/4419270183/in/ gallery-31964157@N00-72157627028472076/ http://www.flickr.com/photos/ben_lawson/2039198622/in/ gallery-31964157@N00-72157627028472076/ http://www.flickr.com/photos/21232564@N06/2234726613/in/ gallery-31964157@N00-72157627028472076/ http://www.flickr.com/photos/wscullin/3770015991/in/ gallery-31964157@N00-72157626883338113/ http://www.flickr.com/photos/dvdmerwe/5111063582/in/ gallery-31964157@N00-72157627028472076/ http://www.flickr.com/photos/auntiep/17135231/in/ gallery-31964157@N00-72157627028472076/

Editor's Notes

  • #2: My company is Wunderkraut.\nWe are based in Munich and do development, consulting and training for Drupal projects\n
  • #3: the session is about finding opportunities to do theming\nand which tools to use\n
  • #4: to be able to do all the cool theming stuff you have to do some detective work\n\n
  • #5: if you ask 5 people, themers or developers you will get 5 different answers ho to do theming\nwe are not talking about wrong or right\n
  • #6: means - the ability of the defendant to commit the crime\n
  • #7: change the default\nremove markup or sometimes whole chunks of themed output\n
  • #8: amazing how much time we spent hiding an removing stuff\n
  • #9: there are many levels in the theme layer where you have opportunity to act\n
  • #10: Opportunity is in various levels of drupal.\nThe deeper you go you get more power? Yes and No\nDeeper meens earlier most of the time\n
  • #11: the real power for the theming gangster is not open stage\n
  • #12: \n
  • #13: \n
  • #14: work on the master plan \n
  • #15: sammy likes....\nsherlock recommends ...\n
  • #16: \n
  • #17: example module\nfield formatter + field widget\n
  • #18: Render API also can be used for reordering\nRender API is very similar to Form API\n
  • #19: \n
  • #20: \n
  • #21: the developers point of view\n
  • #22: The severeness is determined by the amount of damage or casualties. \n
  • #23: actually in Drupal 7 you have preprocessing also for theme functions\n
  • #24: \n
  • #25: \n
  • #26: The onion is a good analogy because it&amp;#x2019;s easy and complex at the same time. \nIt&amp;#x2019;s easy because it&amp;#x2019;s just skin on top of skin all the way from inside out. \nBut its also complex, because the skins have different thickness and colour.\n
  • #27: Render array goes from top down, \nbut with markup I&amp;#x2018;m always thinking &amp;#x201E;inside out&amp;#x201C;\n
  • #28: \n
  • #29: \n
  • #30: \n
  • #31: \n
  • #32: \n
  • #33: \n
  • #34: \n
  • #35: \n
  • #36: \n
  • #37: \n