Converting 6.x themes to 7.x
Overview of Drupal Theme changes in 7.x
- Blocks have new, more meaningful CSS IDs
- Primary and secondary links are now Main and Secondary menu
Blocks have new, more meaningful CSS IDs
Many of the CSS IDs for blocks defined by Drupal core have changed so that they more clearly indicate the purpose of the block:
| Block | Old CSS ID (Drupal 6) | New CSS ID (Drupal 7) |
|---|---|---|
| Recent blog posts | block-blog-0 | block-blog-recent |
| Book navigation | block-book-0 | block-book-navigation |
| Recent comments | block-comment-0 | block-comment-recent |
| Active forum topics | block-forum-0 | block-forum-active |
| New forum topics | block-forum-1 | block-forum-new |
| Language switcher | block-locale-0 | block-locale-language-switcher |
| Syndicate | block-node-0 | block-node-syndicate |
| Most recent poll | block-poll-0 | block-poll-recent |
| Author information | block-profile-0 | block-profile-author-information |
| Search form | block-search-0 | block-search-form |
| Popular content | block-statistics-0 | block-statistics-popular |
| Powered by Drupal | block-system-0 | block-system-powered-by |
| User login | block-user-0 | block-user-login |
| Navigation | block-user-1 | block-user-navigation |
| Who's new | block-user-2 | block-user-new |
| Who's online | block-user-3 | block-user-online |
For example, a Drupal 6 CSS style declaration such as:
/* Make the text in the user login block bigger. */
#block-user-0 {
font-size: 1.5em;
}should become (in Drupal 7):
/* Make the text in the user login block bigger. */
#block-user-login {
font-size: 1.5em;
}Primary and secondary links are now Main and Secondary menu
Primary and Secondary links have been renamed to Main and Secondary menu. Themes which support these options will need to be updated to use the new variable names:
6.x
<div id="menu">
<?php if (isset($secondary_links)) { ?><?php print theme('links', $secondary_links, array('class' => 'links', 'id' => 'subnavlist')); ?><?php } ?>
<?php if (isset($primary_links)) { ?><?php print theme('links', $primary_links, array('class' => 'links', 'id' => 'navlist')) ?><?php } ?>
</div>7.x
<div id="menu">
<?php if (isset($secondary_menu)) { ?><?php print theme('links', $secondary_menu, array('class' => 'links', 'id' => 'subnavlist')); ?><?php } ?>
<?php if (isset($main_menu)) { ?><?php print theme('links', $main_menu, array('class' => 'links', 'id' => 'navlist')) ?><?php } ?>
</div>