This document discusses a web designer reviewing the code for a Drupal theme called "Elm Street" that was created for a client. The designer finds several issues or "nightmares" with the theme including hardcoded links and scripts, unused libraries, unexplained template logic, direct database queries, form API misuse, and leftover code from previous themes. The designer explains each issue and provides suggestions on how to address the problems and improve the theme to follow best practices.
Enhancing User Experience - Exploring the Latest Features of Tallyman Axis Lo...
Theme like a monster #ddceu
1. june 2 0 1 1
THEME LIKE A MONSTER
MAREK SOTAK | ATOMIC ANT
www.atomicant.co.uk
2. OH HAI!
ABOUT ME & ATOMIC ANT
● Web designer, developer
● Over 5 years with Drupal - since v4.6
● International team
● active in Drupal community - rootcandy, organising
events
@sotak -- http://sotak.co.uk - http://atomicant.co.uk
3. DREAM JOB!
NOT REALLY
● They've called in
● Job I didn't really want to do
● Little tweaks, that's what they've said
12. THAT MOMENT
NIGHTMARE NO. 1
● How many libraries you have? Sorry?
● elmstreet.info
jsearchbox.js - custom js, copied? a js function getElementsByClassName?
14. HARDCODED
NIGHTMARE NO. 2
● no $styles variable?
● how about drupal/modules css?
● aggregation?
● exception hardcoded link - conditional stylesheets
● want to remove styles? do it in .info file
stylesheets[all][] = system-menus.css
hook_css_alter();
15. $CLOSURE
NIGHTMARE NO. 3
● page.tpl.php
</div>
<?php require_once($_SERVER['DOCUMENT_ROOT']
."/themes/elmstreet/google_analytics.php");
?>
</body>
</html>
● oh, you already have google analytics module?
16. C A M P B L O O D F R I D A Y 1 3 th
NIGHTMARE NO. 4
● template.php
● Copy, paste but THINK!
17. C A M P B L O O D F R I D A Y 1 3 th
NIGHTMARE NO. 4
● functions like garland_xxx - leftovers
● custom functions get_user(), groupdetails(),...
○ _mytheme_get_user(), mytheme_groupdetails()
19. FORM API MISUSE
NIGHTMARE NO. 6
● Oh Hai "elmstreet_mysearchform" in template.php
● FAPI syntax, returns form array - but where is this being
called from?
● in page.tpl.php via drupal_get_form?
20. UNEXPLAINABLE
NIGHTMARE NO. 7
● Remember?
● So they probably wanted to have a template suggestions
for specific pages incl. headers