adopt or hack - how to hack a theme in a drupal way

Click here to load reader

Post on 17-Aug-2014




0 download

Embed Size (px)


How to create a base theme for Drupal 7


  • Adopt or hack How to hack a theme in a Drupal way London learning meetup 2014 Marek Sotak - @sotak -
  • @sotak
  • You have a vision...
  • Choices...
  • Where is your creativity now?
  • Should I hack or adopt?
  • Drupal police: So you want to hack?
  • Direct code changes are OK if: you know what you are doing you have process behind of keeping changes after upgrade > patches
  • Hack with confidence - systematically
  • Lets put a theme into a theme to override a theme
  • themes nested in each other Due to performance multiple sub-theming is not recommended To make a sub-theme of another theme, we need to declare: base theme = themeName in our sub-theme's .info file Sub-theming
  • Lets try it out
  • Lets create a sub-theme of Bartik called My Bartik 1. Create a new directory in sites/all/themes called mybartik the theme name should be unique the sub-theme can be anywhere in the Drupal structure 2. Create new file within mybartik directory called 3. Edit and insert one line name = My Bartik base theme = bartik core = 7.x 4. See the result on the appearance page Creating a sub-theme
  • Sub-theme shares these resources from its base theme stylesheets scripts *.tpl.php files anything declared in template.php screenshot Creating a sub-theme
  • Sub-theme does not share these resources from its base theme logo.png favicon some .info file settings (regions,...) theme-settings.php color module integration Creating a sub-theme
  • Adding your stylesheet - overriding the CSS in the sub-theme .info file stylesheets[all][] = style.css works same for the scripts scripts[] = script.js Creating a sub-theme
  • Play and learn with CSS - small intro
  • Once you master the CSS > freedom
  • CSS Selectors - CSS Reference - Other resources CSS Resources
  • Base-themes available
  • Base-themes - Do you still need that scaffolding?
  • Creativity comes from looking for the unexpected and stepping outside your own experience. Masaru Ibuka
  • Workshops in London 1 day workshops Basic theming Advanced theming drupal module development Drupal knowledge sharing Consulting 130/person excl. VAT
  • @sotak
  • Image credits Machines - Burglar notice - Cathedral - Containers - Hack systematically - Machines - Police - Cups choices - OK hacking - Pencils - American freedom - Workshop - Workshop 2 - All images are under CreativeCommons license ( Thank you!