• Squiggy Rubio
    Drupal Developer & Themer
August 15, 2011
The web has come a long way since the days when editing website content required knowing HTML and how to use a FTP client. While creating websites has grown in complexity, there are now many platforms, both open source and proprietary, that let people easily publish content on the web without web development skills. The popularity of platforms like Facebook, Tumblr and Wordpress has resulted in many more people publishing content on the web.
January 27, 2011
I love theming Drupal sites. Yes, I realize that means I’m a super nerd. Drupal’s theme layer with its system of overrides is powerful. It works so well that I rarely need a starter theme, like Zen, Basic, Framework or NineSixty nowadays, other than as a reference and source of code snippets. What Starter Themes Do Drupal 6 saw a jump in the number of contributed starter themes on drupal.org. Now it’s much easier to find a list of all starter themes and there are a few great reviews and a comparison chart. Starter themes are a class of themes that attempt to generalize their features to speed up implementing a design for most any site, while encouraging best practices. They are popular among development teams since they help standardize theming when multiple people must touch the theme. They are also excellent demos of the power and potential of Drupal’s theme system, which makes them a great learning tool and source of documentation. Many starter themes are intended to be used as a base theme, where you create a sub-theme that draws off their files. This makes it easier to produce themes with fewer files and overrides, leaving the base/starter theme to do most of the heavy lifting. A closer review of contributed starter themes reveals some recurring features, including:
April 08, 2010
Drupal 6 provides many avenues to modify its appearance, including ways to theme a form. Recently I themed all node edit forms at once. I will share here how I did it. The usual route to theme a node edit form, or any form for that matter, is to grab the form ID, which is used as a theme hook, and implement a hook_theme function in template.php in the theme.function MYTHEME_theme() { return array(    'blog_node_form' => array(      'arguments' => array('form' => NULL),      'template' => 'blog-node-form',    )  );}?> This lets you alter the theme registry to add a template file for a specific form. There are many blog posts that go into more detail than I do here on how to theme forms in general. The above is useful if I want to theme a blog content type or the user registration form, for example. Most sites have at least a few different content types. I wanted to make alterations to all node forms at once and use a single template file. This involved a slightly different approach. Correction: This next step with the theme_registry_alter example is not necessary. See comments below this post. There is a theme_node_form theme function in Drupal, which is called by all node forms. I wanted to replace or supersede this theme function with a template. I tried to do this with hook_theme, but it continued to pick up some parts of theme_node_form in addition to supporting my template file. So it called the form array twice, causing recursion; which is not what I expected. So instead I took a colleague's suggestion and altered the theme registry via hook_theme_registry_alter(). This seemed clean and simple enough. This takes the node_form theme hook and changes it from a theme function to a template, in sites/all/themes/MYTHEME/template.php:function MYTHEME_theme_registry_alter(&$theme_registry) {  $theme_registry['node_form'] = array(    'template' => 'node-form',    'arguments' => array('form' => NULL)  );}?> This worked great. But I hear that hook_theme_registry_alter is intended for use in modules only? If you know why, please chime in with a comment. Or leave a comment on the theme registry for special cases handbook page. And the fun part... Spiffing up the node edit form Here is what I did. This creates two columns for the form and places all top level form fieldsets on the right. Screenshot: And here is how I did it...
January 28, 2009
Perusing the themes available on drupal.org reveals that there are over seven starter themes for Drupal 6 in addition to Zen, the original "starter" theme for Drupal. Starter or "base" themes are a class of themes that seek to provide best-practices starting points for themers to build unique designs. Most include a common set of features necessary for most sites, helping to minimize the repetition of a themer recreating many similar files, markup and code for each project.