I would like my site builders to be able to select from three unique front page layouts. The selection can be made either through config or through theme settings, but not require any coding. The three pages have different pieces of content consisting mostly of fields. I've looked at panels but I would prefer to use something a little lighter as panels seems like a lot for this one piece of functionality. Has anyone here solved a similar problem?


You could use the Omega theme's layout extension.

  • Yes, it sounds like omega theme with the delta module would work, but I already have a custom theme so that's not going to work for me. I think my best bet might be using context with bean, but they're both pretty new to me. – mikemmike Mar 1 '15 at 3:39

You could add a checkbox in the theme settings and adjust the page template accordingly in a page preprocess.

Something similar to this would go in the theme-settings.php file in your theme...

function THEMENAME_system_theme_settings_alter(&$form, $form_state) {
    $form['front_layout'] = array(
      '#type'          => 'radios',
      '#title'         => t('Front Page Layout'),
      '#options'       => array(
        'layout_1' => t('Layout 1'),
        'layout_2' => t('Layout 2'),
        'layout_3' => t('Layout 3'),
      '#default_value' => theme_get_setting('front_layout'),

Add new page template suggestions in a page preprocess ...

function THEMENAME_preprocess_page(&$variables) {
  if ($is_front) {
    $layout_setting = theme_get_setting('front_layout');
    $variables['theme_hook_suggestions'][] =  'page__' . $layout_setting;

This would allow you to have separate page templates for each layout. An example being page--layout-3.tpl.php.

If it's merely css changes you need, you could add a body class in an html preprocess ...

function THEMENAME_preprocess_html(&$variables, $hook) {
  if ($is_front) {
    $layout_setting = theme_get_setting('front_layout');
    $variables['classes_array'][] = drupal_html_class($layout_setting);

In this example you would have a "layout-1", "layout-2" or "layout-3" class on the body element.

  • Awesome, this is exactly what I was looking for - thanks! I tried to upvote your answer but I don't have enough reputation points yet. – mikemmike Mar 10 '15 at 5:08

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.