You are here

function touch_icons_preprocess_page in Touch Icons 6

Implementation of hook_preprocess_page().

Output <link> elements for the touch icons.

File

./touch_icons.module, line 384
Adds a fieldset to theme settings form which allows site administrators to specify Apple Touch icons for Drupal websites. The Touch icon settings behave in a similar manner to the Site Logo and Favicon settings provided by Drupal core.

Code

function touch_icons_preprocess_page(&$variables) {
  global $theme_key;
  $touch_icons_links = '';

  // output link for plain touch icon
  $url_plain = _touch_icons_create_touch_icon_url($theme_key);
  if (check_url($url_plain)) {
    $touch_icons_links .= '<link href="' . $url_plain . '" type="' . file_get_mimetype($url_plain) . '" rel="apple-touch-icon" />' . "\n";
  }

  // output link for precomposed touch icon
  $url_precomp = _touch_icons_create_touch_icon_url($theme_key, TRUE);
  if (check_url($url_precomp)) {
    $touch_icons_links .= '<link href="' . $url_precomp . '" type="' . file_get_mimetype($url_precomp) . '" rel="apple-touch-icon-precomposed" />' . "\n";
  }
  drupal_set_html_head($touch_icons_links);
  $variables['head'] = drupal_get_html_head();
}