function _touch_icons_create_touch_icon_url in Touch Icons 6
Returns a URL for a touch icon image file, for any theme.
Parameters
$key: The theme which we need the touch icon URL for.
$precomp: Specify TRUE if the precomposed touch icon variant is required. Default value is FALSE, i.e. the plain touch icon variant.
Return value
A URL for the touch icon.
1 call to _touch_icons_create_touch_icon_url()
- touch_icons_preprocess_page in ./
touch_icons.module - Implementation of hook_preprocess_page().
File
- ./
touch_icons.module, line 417 - 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_create_touch_icon_url($key, $precomp = FALSE) {
$themes = list_themes();
$theme_object = $themes[$key];
$settings = theme_get_settings($key);
$icon_type = $precomp ? 'precomp' : 'plain';
$default_filename = 'apple-touch-icon' . ($precomp ? '-precomposed' : '') . '.png';
// build apple-touch-icon URL
$url = '';
if (!empty($settings['toggle_touch_icon_' . $icon_type])) {
if (!empty($settings['default_touch_icon_' . $icon_type])) {
if (file_exists($touch_icon = dirname($theme_object->filename) . '/' . $default_filename)) {
$url = base_path() . $touch_icon;
}
else {
$url = base_path() . drupal_get_path('module', 'touch_icons') . '/' . $default_filename;
}
}
elseif ($settings['touch_icon_' . $icon_type . '_path']) {
$url = base_path() . $settings['touch_icon_' . $icon_type . '_path'];
}
}
return $url;
}