2

I have drupal site that uses the adaptive theme. Now the link in the logo is directed to "/" (to root of my site) but I would like to change it so that it would dirent to outside site (www.domain.com). How can I do this?

This where the logo image is created in template.preprocess-page.inc but I have no clue where the URL gets to the logo. Any advie would be apprerciated!

$vars['logo_alt_text']    = check_plain(variable_get('site_name', '')) .' '. t('logo');
$vars['logo_img']         = $vars['logo'] ? '<img src="'. check_url($vars['logo']) .'" alt="'. $vars['logo_alt_text'] .'" title="'. t('Home page') .'"/>' : '';
$vars['linked_site_logo'] = $vars['logo_img'] ? l($vars['logo_img'], '<front>', array('attributes' => array('rel' => 'home'), 'title' => t('Home page'), 'html' => TRUE)) : '';
$vars['linked_site_name'] = $vars['site_name'] ? l($vars['site_name'], '<front>', array('attributes' => array('rel' => 'home'), 'title' => t('Home page'))) : '';
Charles
  • 50,943
  • 13
  • 104
  • 142
dasop
  • 21
  • 2

2 Answers2

2

This line sets the logo as a img link:

$vars['linked_site_logo'] = $vars['logo_img'] ? l($vars['logo_img'], '<front>', array('attributes' => array('rel' => 'home'), 'title' => t('Home page'), 'html' => TRUE)) : '';

With $vars['logo_img'] being the image, and <front> being the url for the link. l() is a function built into Drupal. Documentation on l()

Also you may wish to read more about preprocess functions: Setting up variables for use in a template (preprocess and process functions)

Laxman13
  • 5,226
  • 3
  • 23
  • 27
  • Maybe I didnt understand but if I change the '' part to my domain (www.domain.com for example) it adds after my current url.. like this www.currensite.com/www.domain.com – dasop Jun 29 '11 at 16:06
  • @dasop If you want to link to an external domain, you need to add `http://` to the beginning of the url, or else Drupal will assume it is a relative path – Laxman13 Jun 29 '11 at 16:15
0

There are different file to be set for Drupal 6, 7 & 8. It may happen also in Drupal 9 and further.

On Drupal 6 set it in template.preprocess-page.inc.
On Drupal 7 we need to set it in template.php.
On Drupal 8 twig the vars in THEME.theme.

If your custom logo is not shown while your html code is already rendered in the page source then you may need to disable the theme logo by uncheck it on your theme setting.

Community
  • 1
  • 1
eQ19
  • 9,880
  • 3
  • 65
  • 77