If declaring a custom region or feature in a theme, all defaults must be declared or they are lost

Benjamin Melançon's picture
Submitted by Benjamin Melançon on 2010, August 4 - 13:03

Tags

  • unfinished
  • If a theme uses only default regions or feature settings, it does not need to define them in its .info file. If even one additional region is used, it must define all regions, the default ones it wants to keep and the new ones. The same holds for features. This is true for subthemes, also: If our parent theme uses only the default regions, and so doesn't define any, and so our copy of its .info file doesn't define any, we'll lose all the default regions the moment we define a region ourselves. To avoid this confusion and simply to know what our need to list all of the default regions and settings. The default regions in Drupal 7 are left, right, content, header, footer, and help. The default features which can be toggled on and off are

    Logo (logo), Site name (name), slogan (Site slogan), node_user_picture (User pictures in posts), comment_user_picture (User pictures in comments),
    User verification status in comments
    Shortcut icon (favicon)
    Main menu (primary_links)
    Secondary menu (secondary_links)

    This tip was brought to you courtesy of idly watching the #drupal-themes IRC channel when Stephanie Pakrul (better known there as stephthegeek) and Randy Fay (rfay) discussed the issue.

  • Explanation

  • #drupal-themes 18:33 rfay: Aren't a theme's regions always supposed to be in the .info file? Why does garland not have them? 18:36 stephthegeek: rfay, if it only has the default regions (header, footer, left, right), it doesn't need to declare them 18:36 rfay: stephthegeek, thanks. The only problem is when you add one to a subtheme :-) 18:37 rfay: Then it all blows sky-high 18:37 stephthegeek: rfay, yeah you need to list them all then 18:37 stephthegeek: you can't just add to it 18:37 stephthegeek: theme settings are the same way 18:37 rfay: stephthegeek, but theme settings are always listed in the parent's .info, true? So you can just copy them. 18:38 stephthegeek: rfay, no, i think they're the same way.. 18:38 stephthegeek: if you have the usual (primary, secondary, logo, etc) defaults you don't have to declare them 18:38 stephthegeek: just if you want to have one less or custom ones :) 18:38 rfay: stephthegeek, thanks for the warning :-)
  • Book element

  • Gotcha