Move site logo to menu region

Events happening in the community are now at Drupal community events on www.drupal.org.
irow's picture

I would like to place the site logo in the menu region, to the left of the menu bar. So far I am unable to move it from the branding region. Is it possible to move it? If not, any tips to help me display a graphic next to the menu bar?

Comments

Perhaps the simplest way to

bhosmer's picture

Perhaps the simplest way to accomplish this might be to add your image to a block and then place your block within the menu region. You could style it with CSS and float it left.

Then simply hide the official site logo.

omega_tools ?

rachel_norfolk's picture

Doesn't the Omega tools module create a bunch of blocks, one of which contains the logo image code? I thought it did...

Rachel

You can use the blockify

Argus's picture

You can use the blockify module for this.

Changes are required in your template.php

westie's picture

Swap out THEMENAME for your theme and NEWREGION for the region you want your logo in.

/**
* Implements hook_process_region().
*/
function THEMENAME_process_region(&$vars) {
  if (in_array($vars['elements']['#region'], array('content', 'menu', 'NEWREGION'))) {
    $theme = alpha_get_theme();
   
    switch ($vars['elements']['#region']) {
      case 'content':
        $vars['title_prefix'] = $theme->page['title_prefix'];
        $vars['title'] = $theme->page['title'];
        $vars['title_suffix'] = $theme->page['title_suffix'];
        $vars['tabs'] = $theme->page['tabs'];
        $vars['action_links'] = $theme->page['action_links'];     
        $vars['title_hidden'] = $theme->page['title_hidden'];
        $vars['feed_icons'] = $theme->page['feed_icons'];
        break;
     
      case 'menu':
        $vars['main_menu'] = $theme->page['main_menu'];
        $vars['secondary_menu'] = $theme->page['secondary_menu'];
        break;
     
      case 'NEWREGION':
        $vars['site_name'] = $theme->page['site_name'];
        $vars['linked_site_name'] = l($vars['site_name'], '<front>', array('attributes' => array('rel' => 'home', 'title' => t('Home')), 'html' => TRUE));
        $vars['site_slogan'] = $theme->page['site_slogan'];     
        $vars['site_name_hidden'] = $theme->page['site_name_hidden'];
        $vars['site_slogan_hidden'] = $theme->page['site_slogan_hidden'];
        $vars['logo'] = $theme->page['logo'];
        $vars['logo_img'] = $vars['logo'] ? '<img src="' . $vars['logo'] . '" alt="' . $vars['site_name'] . '" id="logo" />' : '';
        $vars['linked_logo_img'] = $vars['logo'] ? l($vars['logo_img'], '<front>', array('attributes' => array('rel' => 'home', 'title' => t($vars['site_name'])), 'html' => TRUE)) : '';
        break;     
    }
  }
}

No need for anything other

cellar door's picture

No need for anything other than the Delta Module. You get the option under Delta Blocks to create a logo block. Simply disable the block in the subtheme and place the logo block wherever you'd like. I do it on all my sites so I can have more control over the logo and it's placement.

+1 what cellar-door

banghouse's picture

+1 what cellar-door said...

And also be sure to disable the logo in global settings otherwise you'll run into a strange happening where the logo will disappear with every save of the theme settings. This is one of those gotchas that I have spent more than my fair share of head-scratching time on.

Although I do like the delta

doom_fist's picture

Although I do like the delta blocks option, I think there are a few good arguments for making the variables available in custom theme locations (regions). Westie's code helped me out greatly, but it raises questions in my mind (coming to omega 3.x from omega 3.x-beta3)-

I was using some code for my subtheme's process-region.inc that read identically to Westie's, with one small difference: Where Westie writes:

$theme->page['site_name']

I had:

$GLOBALS['page']['site_name']

This still produces the variables necessary for the subtheme on my server that still runs the 3.x-beta3 version of omega, but not on my live server. On my new server my previous technique of using $GLOBALS['page'] (which I got from the existing process files in omega and alpha core) produces Undefined Index errors.

Did something change? It also seems like the core versions of omega and alpha used to have process and preprocess folders and files, where as if you download the current official 3.x of omega, the core themes no longer have these files. Can anyone clue me in on what happened? Anyway, thanks, Westie, for the tip.

Page alter

ishmael-sanchez's picture

The code posted by westie didn't work for me using D7 but I was able to use a page alter to add the logo to the correct region and I disabled on the theme settings page. The idea of installing a module just to move a logo seems like overkill unless you plan to use it for more than just that.

Omega Framework

Group organizers

Group notifications

This group offers an RSS feed. Or subscribe to these personalized, sitewide feeds: