Theme Structure

The CERN infrastructure officially consists of two base themes and two main themes

Base Themes

  • Bootstrap theme: is a contributed Drupal theme that consists the base of all CERN themes. 
  • CERN Base theme: is a CERN theme that keeps basic styles of the themes. The CERN Base theme is not visible to the users. You cannot enable it and set it as your theme. However you can find it's code in the Web Team's gitlab repository.

Main Themes

  • CERN theme: Constitutes the main theme that comes with all CERN Drupal websites. You can read more about the CERN theme in the webtools documentation or you can have a look in it's code in the Web Team's Gitlab repository.
  • CERN override theme: The CERN override theme is used in order to override the CERN theme. In other words, if you want to apply a change in the CERN theme then you should use the CERN Override theme. You can read more about the theme in the webtools documentation.


Structure and Inheritance


CERN Themes structure


Each theme in Drupal can inherit settings, characteristics, styles, templates from another theme. The theme that is inherited is called parent theme or base theme and the theme that is inherits is called child theme or sub-theme. At CERN, theme inheritance is broadly used as it is visible in the graph above. More specifically, the CERN Base inherits from Bootstrap while the CERN theme inherits from CERN Base. Finally, the CERN Override theme inherits from the CERN theme. The latter is actually the reason why you can apply changes in the CERN theme using the CERN override theme.


But why should you care about theme inheritance? The answer is simple. As already mentioned, a theme inherits all the styles, templates etc of another theme. If you want to change one of them, then you should be aware from where the theme inherited the current configuration. For example if you want to apply a change on a template, you can visit the official repository of the Drupal bootstrap theme, then copy the template that you want to override and finally apply the change in the overridden template. Be careful though to search for the template starting from the bottom of the inheritance graph because a template might be overridden from a theme of a lower level.