public static function DrupalFavicon::fetchFile in Favicon 7.2
Fetches the favicon file object.
This will attempt to retrieve the calculated favicon based on the current theme and base URL.
Parameters
string $theme: (optional) The theme to use for determining the favicon file. If not provided, the current theme will be used.
bool $cached: (optional) TRUE if the cached should be used, or FALSE if it should be skipped.
Return value
object The favicon file object.
2 calls to DrupalFavicon::fetchFile()
- FaviconTestBase::assertFavicon in tests/
FaviconTestBase.test - favicon_get_favicon_file in ./
favicon.module - Fetches the favicon URI.
File
- src/
DrupalFavicon.php, line 103
Class
Code
public static function fetchFile($theme = NULL, $cached = TRUE) {
// If the variable is being used, use it before using cached data.
if ($uri = variable_get('favicon_uri')) {
return static::getFileFromUri($uri);
}
if (!isset($theme)) {
$theme = !empty($GLOBALS['theme_key']) ? $GLOBALS['theme_key'] : '';
}
$cid = FALSE;
if ($cached) {
$cache_data = array(
'theme' => $theme,
'base_url' => $GLOBALS['base_url'],
'conf_path' => conf_path(),
);
drupal_alter('favicon_cache_data', $cache_data);
$cid = 'favicon:' . md5(serialize($cache_data));
}
if ($cached && ($cache = cache_get($cid))) {
return $cache->data;
}
else {
$favicon = new static($theme);
if ($cached) {
cache_set($cid, $favicon
->getFile());
}
return $favicon
->getFile();
}
}