How to implement simple AMP support in Drupal 8
15+ Ways to Debug Drupal 8 (for Front-Enders)
Drupal 8, Xdebug, and Twig - An Update
Twig Concepts in Drupal 8 Themes - Part II
Twig Concepts in Drupal 8 Themes - Part I
A Better Way to Administrate Drupal - Part 2
It's Official, Chapter Three has Adopted ES2015
How to Turn Off Drupal 8 Caching
A Better Way to Administrate Drupal - Part 1
Why Progressive Decoupling Drupal's Front-End is a Bad Idea
Drupal 8 Theming: Basic guide to theme *.info.yml files
How to Create Custom Theme Suggestions in Drupal 8
8 Months of Drupal 8 On Production
Drupal 8 Theming: Setting up theme debugging
Decapitated Drupal: The Downsides of Decoupling
Getting Started with Gulp
Presentation: Drupal 8 Theming
Spreading the Drupal Knowledge
A Drupal 8 Festivus
Ruby, RVM, Gemsets and Bundler/Gemfiles
5 Hurdles to Adopting Drupal 8
Leveling Up Your Themer (lvl-0): Contributed Themes & Modules
Drupal can be complicated, but with that comes incredible power and flexibility. The Drupal theme system creates the perfect storm of complexity, UX and control from the interface. Drupal theming isn't easy, but even the layman can do incredible things through pointing and clicking. And if you want to do things The Drupal Way, it's vitally important to learn to let Drupal do what it can from the interface (before even thinking about touching code).
Interesting uses for :hover
We all have to admit that CSS has some shortcomings. Thanks to the adoption of CSS3 and increasing standardization between browsers, this is getting better. During a recent course on responsive theming, I discovered a neat trick to trigger a click effect on elements in a mobile browser. It utilized the common css pseudo-class :hover, but when you add some CSS3 transitions it starts to get really interesting.
Leveling Up Your Themer (lvl2): Base Themes
I consider use of a base theme to be Level 2 theming because this should mean that you've either grown enough or failed enough as a themer to want to do things the Drupal way. That means no longer hacking core and saving yourself a ton of hassle. You can let Drupal do the work for you and still make the theme your own!
The Evolution of a Themer
Leveling Up Your Themer (lvl1): Getting Started
In Level 1 we introduce the anatonmy of the theme and the files you'll find within. We walk through creating your own basic theme and introduce the concept of sub-theming.
In the "evolution of a themer", this is where the fun really starts. Up until now you may have downloaded a contributed theme from Drupal.org, maybe you hacked the theme a bit to make it your own but you've never made your own theme. This blog post is all about reaching Level 1 and creating your own basic theme from scratch.
Presentation: How to Build a Mobile Site with Drupal
Co-presented by Andrew Berry, Lullabot.
The trend towards a "mobile first" use of the web is showing no signs of slowing down. It's no longer enough to have websites that are functional on mobile. They must work well and feel natural on mobile devices to attract and keep visitors.
Presentation: Front-End Module Round Up
Why I Rarely Use Starter Themes
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:
Fun Theming All Node Edit Forms at Once
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.
'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...
HOWTO: Fully Theme and Customize the Drupal User Registration Form
Just a little to the left please. Flip it around. Put that on top of this. Call it by a different name. It is the little changes, that seem trivial and small, that often end up being real headaches to make and support our clients in making. Do we really want to try to build capacity with clients by teaching them to adjust #weight in hook_form_alter?