Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Render favicon in admin area the same way as on frontend #5062

Closed
Jimmi08 opened this issue Aug 17, 2023 · 1 comment
Closed

Render favicon in admin area the same way as on frontend #5062

Jimmi08 opened this issue Aug 17, 2023 · 1 comment
Labels
type: enhancement An improvement or new feature request
Milestone

Comments

@Jimmi08
Copy link
Contributor

Jimmi08 commented Aug 17, 2023

Motivation

one rule for favicon rendering
correct site favicon visible in admin asap after loading in prefs

Proposed Solution

renderFavicon() to admin header.php

Additional Context

It is easy to change. But the function renderFavicon() is part of header_default.php so it would be needed to copy to admin/header.php. And it means duplicate code for the same thing.

Thanks

// --------  Generate Apple Touch Icon ---------
echo renderFavicon();


function renderFavicon()
{
	// ---------- Favicon ---------
	if (file_exists(THEME . "favicon.ico"))
	{
		return "<link rel='icon' href='" . THEME_ABS . "favicon.ico' type='image/x-icon' />\n<link rel='shortcut icon' href='" . THEME_ABS . "favicon.ico' type='image/xicon' />\n";
	}
	elseif (file_exists(e_MEDIA_ICON . '16x16_favicon.png'))
	{
		$iconSizes = [16 => 'icon', 32 => 'icon', 48 => 'icon', 192 => 'icon', 167 => 'apple-touch-icon', 180 => 'apple-touch-icon'];
		$text = '';
		foreach ($iconSizes as $size => $rel)
		{
			$sizes = $size . 'x' . $size;
			$text .= "<link rel='$rel' type='image/png' sizes='$sizes' href='" . e_MEDIA_ICON_ABS . $sizes . "_favicon.png'>\n";
		}
		return $text;
	}
	elseif (file_exists(e_BASE . "favicon.ico"))
	{
		return "<link rel='icon' href='" . SITEURL . "favicon.ico' type='image/x-icon' />\n<link rel='shortcut icon' href='" . SITEURL . "favicon.ico' type='image/xicon' />\n";
	}
}
@Jimmi08 Jimmi08 added the type: enhancement An improvement or new feature request label Aug 17, 2023
@CaMer0n CaMer0n added this to the e107 2.3.3 milestone Oct 17, 2023
@CaMer0n
Copy link
Member

CaMer0n commented Oct 17, 2023

@Jimmi08 This has been completed. Please comment here if you find any issues with the commit.

@CaMer0n CaMer0n changed the title render favicon in admin area the same way as on frontend Render favicon in admin area the same way as on frontend Nov 23, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: enhancement An improvement or new feature request
Projects
None yet
Development

No branches or pull requests

2 participants