Drupalcon advanced theming techniques

From Colettapedia
Jump to navigation Jump to search
  • views 2 takes advantage of themes, you can choose what theme to use.

Anatomy of a theme

  1. info
  2. template override
  3. function override
  4. theme at module level

.info file

  1. add stylesheets - css
  2. add regions to theme
  3. provide default settings
  4. include javascripts - jquery libs add-ons

template overrides

  1. .tpl files containg html markup
  2. useful for subtheming

function overrides

  1. make decisions where logic is needed
  2. better for performance - 5 times more efficient than template files

theming at the module level

  1. needed for theming new functionality

overriding preprocessing functions

  • preprocess functions better than template files
  • preprocess funnctions arent hooks!
    • sepatrate logic from appearance
    • less msintenance
  1. copy and paste from include into template.php, and change name
  • have look in theme registry or test with function_exists(), has it been overridden already?
    • if module overrode theme you need to know anytime your theme's overrided, call theme_links or the custom... avoid dependencies on module... prehaps on multi site

subtheming

  • take theme closer to final code without writing a line a of code
  • use zen as base without having to merge changes
  • separate out logic and appearance of theme
    • create design1 appearance theme
    • have nothing but the css
    • create another subtheme called logic that deals with specific modules, client

theming forms

  • clear the cache!!
  • forms are special case
  • target a specific form?
  • this form? use this template, this function
  1. modify individual form elements