This originates from a request (https://drupal.org/node/1668528#comment-6544174) by @logicdesign on the Sans Druplicon project application ticket #1668528: Sans Druplicon. I've moved it here so it can be tracked independently. The request was:

I see that this module doesn't work well with admin_menu. The icon on the admin_menu bar is still the default from drupal. Is it possible to change that?I believe 80% of Drupal projects uses administration menu module.

Comments

cubeinspire’s picture

To be more precise, the favicon appears when Admin Menu is activated and the Administration menu Toolbar style is disabled.

As I see on the admin menu module the function genrating this icon is inside the file admin_menu.inc and is called template_preprocess_admin_menu_icon. Line 907.

function template_preprocess_admin_menu_icon(&$variables) {
  // Image source might have been passed in as theme variable.
  if (!isset($variables['src'])) {
    if (theme_get_setting('toggle_favicon')) {
      $variables['src'] = theme_get_setting('favicon');
    }
    else {
      $variables['src'] = base_path() . 'misc/favicon.ico';
    }
  }
  // Strip the protocol without delimiters for transient HTTP/HTTPS support.
  // Since the menu is cached on the server-side and client-side, the cached
  // version might contain a HTTP link, whereas the actual page is on HTTPS.
  // Relative paths will work fine, but theme_get_setting() returns an
  // absolute URI.
  $variables['src'] = preg_replace('@^https?:@', '', $variables['src']);
  $variables['src'] = check_plain($variables['src']);
  $variables['alt'] = t('Home');
}

I think the interesting line here is:
$variables['src'] = base_path() . 'misc/favicon.ico';

So the question is... is there some alter template_preprocess_hook in D7 ?
Is it possible to modify the $variables before arriving to this function ?
Othewise the favicon is hardcoded and I don't see how to change it from an external module...

How would you face this problem fatleaf ?

andrewkamm’s picture

Thanks for the interest, I'll be posting on this ticket soon.

andrewkamm’s picture

Status: Active » Fixed

I've extended the module to modify the icon shown in admin_menu. The change to the admin menu icon is done by implementing hook_admin_menu_output_alter(), though improvements have been made throughout this module to improve overall organization.

cubeinspire’s picture

Thanks for the info and very nice module by the way.

andrewkamm’s picture

Status: Fixed » Closed (fixed)

Closing issue as resolved.

javiereduardo’s picture

Version: » 7.x-1.3
Issue summary: View changes

or, css:

	img.admin-menu-icon {
		background-image: url("../favicon.ico");
		padding-left: 16px;
	}