You are here

function template_preprocess_admin_menu_icon in Administration menu 8.3

Same name and namespace in other branches
  1. 7.3 admin_menu.inc \template_preprocess_admin_menu_icon()

Preprocesses variables for theme_admin_menu_icon().

File

./admin_menu.inc, line 894
Menu builder functions for Administration menu.

Code

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');
}