Favicon
The favicon of the frontend or backend context will be modified regarding the environment and the associated configuration.
Favicon Example
Table of Contents
Frontend
For the frontend, the original favicon will either be fetched from the typoscript configuration
page. (see typoscript reference)
or can be handled by your own fluid template via the Favicon:
<html xmlns:env="http://typo3.org/ns/KonradMichalik/Typo3EnvironmentIndicator/ViewHelpers"
data-namespace-typo3-fluid="true">
{f:uri.resource(path:'EXT:your_extension/Resources/Public/Favicon/favicon.png') -> env:favicon()}
{env:favicon(favicon:'EXT:your_extension/Resources/Public/Favicon/favicon.png')}
Backend
For the backend, the favicon will be fetched by the extension configuration of
$GLOBALS.
Favicon Examples
Scope
By default, the Favicon indicator applies modifications to both frontend and backend. You can restrict it to a specific application type using the Scope enum:
use KonradMichalik\Typo3EnvironmentIndicator\Configuration\Handler;
use KonradMichalik\Typo3EnvironmentIndicator\Configuration\Indicator;
use KonradMichalik\Typo3EnvironmentIndicator\Configuration\Trigger;
use KonradMichalik\Typo3EnvironmentIndicator\Enum\Scope;
use KonradMichalik\Typo3EnvironmentIndicator\Image;
Handler::addIndicator(
triggers: [
new Trigger\ApplicationContext('Development*'),
],
indicators: [
// Only modify the frontend favicon
new Indicator\Favicon(
configuration: [
new Image\Modifier\TextModifier([
'text' => 'DEV',
'color' => '#bd593a',
]),
],
scope: Scope::Frontend,
),
],
);
Available scope values:
Scope::(default): Apply to both frontend and backend.Global Scope::: Apply only to the frontend.Frontend Scope::: Apply only to the backend.Backend
Modifiers
The favicon modification configuration can be found in
$GLOBALS.
Add a configured favicon modifier to the desired environment (e.g. Testing) in your ext_:
use KonradMichalik\Typo3EnvironmentIndicator\Configuration\Handler;
use KonradMichalik\Typo3EnvironmentIndicator\Configuration\Indicator;
use KonradMichalik\Typo3EnvironmentIndicator\Configuration\Trigger;
use KonradMichalik\Typo3EnvironmentIndicator\Image;
Handler::addIndicator(
triggers: [
new Trigger\ApplicationContext('Testing')
],
indicators: [
new Indicator\Favicon([
new Image\Modifier\TextModifier([
'text' => 'TEST',
'color' => '#f39c12',
'stroke' => [
'color' => '#ffffff',
'width' => 3,
],
])
])
]
);
The modifiers will be executed one after the other. You can combine them if you want.
The following modifier classes are available:
TextModifier
This is the default modifier if no own configuration is set.
use KonradMichalik\Typo3EnvironmentIndicator\Configuration\Handler;
use KonradMichalik\Typo3EnvironmentIndicator\Configuration\Indicator;
use KonradMichalik\Typo3EnvironmentIndicator\Configuration\Trigger;
use KonradMichalik\Typo3EnvironmentIndicator\Image;
Handler::addIndicator(
triggers: [
new Trigger\ApplicationContext('Development')
],
indicators: [
new Indicator\Favicon([
new Image\Modifier\TextModifier([
'text' => 'DEV',
'color' => '#bd593a',
'stroke' => [
'color' => '#ffffff',
'width' => 3,
],
])
])
]
);
Additional optional configuration keys:
font(string): The font file path for the text. Default isEXT:.typo3_ environment_ indicator/ Resources/ Public/ Fonts/ Open Sans- Bold. ttf position(string): The position of the text. Default istop. Possible values arebottom,top.stroke(array): Optional stroke configuration for the text outline. If set, it requires the sub-keyscolor(string) andwidth(numeric).
TriangleModifier
Adds a triangle indicator to the favicon.
use KonradMichalik\Typo3EnvironmentIndicator\Configuration\Handler;
use KonradMichalik\Typo3EnvironmentIndicator\Configuration\Indicator;
use KonradMichalik\Typo3EnvironmentIndicator\Configuration\Trigger;
use KonradMichalik\Typo3EnvironmentIndicator\Image;
Handler::addIndicator(
triggers: [
new Trigger\ApplicationContext('Development')
],
indicators: [
new Indicator\Favicon([
new Image\Modifier\TriangleModifier([
'color' => '#bd593a',
])
])
]
);
Additional optional configuration keys:
size(float): The percentage size of the triangle. Default is0..7 position(string): The position of the triangle. Default isbottom right. Possible values arebottom left,bottom right,top left,top right.
CircleModifier
Adds a circle indicator to the favicon.
use KonradMichalik\Typo3EnvironmentIndicator\Configuration\Handler;
use KonradMichalik\Typo3EnvironmentIndicator\Configuration\Indicator;
use KonradMichalik\Typo3EnvironmentIndicator\Configuration\Trigger;
use KonradMichalik\Typo3EnvironmentIndicator\Image;
Handler::addIndicator(
triggers: [
new Trigger\ApplicationContext('Development')
],
indicators: [
new Indicator\Favicon([
new Image\Modifier\CircleModifier([
'color' => '#bd593a',
])
])
]
);
Additional optional configuration keys:
size(float): The percentage size of the circle. Default is0..4 position(string): The position of the circle. Default isbottom right. Possible values aretop left,top center,top right,center left,center,center right,bottom left,bottom center,bottom right.padding(float): The percentage padding of the circle. Default is0..1
FrameModifier
Adds a frame around the favicon.
use KonradMichalik\Typo3EnvironmentIndicator\Configuration\Handler;
use KonradMichalik\Typo3EnvironmentIndicator\Configuration\Indicator;
use KonradMichalik\Typo3EnvironmentIndicator\Configuration\Trigger;
use KonradMichalik\Typo3EnvironmentIndicator\Image;
Handler::addIndicator(
triggers: [
new Trigger\ApplicationContext('Development')
],
indicators: [
new Indicator\Favicon([
new Image\Modifier\FrameModifier([
'color' => '#bd593a',
])
])
]
);
Additional optional configuration keys:
border(float): The border size of the frame. Default isSize 5.
ReplaceModifier
Replace the original favicon with a custom one regarding the environment.
use KonradMichalik\Typo3EnvironmentIndicator\Configuration\Handler;
use KonradMichalik\Typo3EnvironmentIndicator\Configuration\Indicator;
use KonradMichalik\Typo3EnvironmentIndicator\Configuration\Trigger;
use KonradMichalik\Typo3EnvironmentIndicator\Image;
Handler::addIndicator(
triggers: [
new Trigger\ApplicationContext('Development')
],
indicators: [
new Indicator\Favicon([
new Image\Modifier\ReplaceModifier([
'path' => 'EXT:sitepackage/Resources/Public/Icons/favicon.png',
])
])
]
);
OverlayModifier
Overlay an additional image to the original favicon regarding the environment.
use KonradMichalik\Typo3EnvironmentIndicator\Configuration\Handler;
use KonradMichalik\Typo3EnvironmentIndicator\Configuration\Indicator;
use KonradMichalik\Typo3EnvironmentIndicator\Configuration\Trigger;
use KonradMichalik\Typo3EnvironmentIndicator\Image;
Handler::addIndicator(
triggers: [
new Trigger\ApplicationContext('Development')
],
indicators: [
new Indicator\Favicon([
new Image\Modifier\OverlayModifier([
'path' => 'EXT:sitepackage/Resources/Public/Icons/favicon.png',
])
])
]
);
Additional configuration keys (required by the modifier, but provided via default configuration):
size(float): The percentage size of the overlay. Default is0..5 position(string): The position of the overlay. Default isbottom right. Possible values aretop left,top center,top right,center left,center,center right,bottom left,bottom center,bottom right.padding(float): The percentage padding of the overlay. Default is0..1
ColorizeModifier
Colorize the original favicon with a specific color regarding the environment.
Warning
This modifier is only available with "Imagick" image driver.
use KonradMichalik\Typo3EnvironmentIndicator\Configuration\Handler;
use KonradMichalik\Typo3EnvironmentIndicator\Configuration\Indicator;
use KonradMichalik\Typo3EnvironmentIndicator\Configuration\Trigger;
use KonradMichalik\Typo3EnvironmentIndicator\Image;
Handler::addIndicator(
triggers: [
new Trigger\ApplicationContext('Development')
],
indicators: [
new Indicator\Favicon([
new Image\Modifier\ColorizeModifier([
'color' => '#039BE5',
])
])
]
);
Additional optional configuration keys:
opacity(float): Controls the opacity of the colorization. Default is1.brightness(integer): Controls the brightness of the colorization. Possible values are from-100to100.contrast(integer): Controls the contrast of the colorization. Possible values are from-100to100.
Note
If you want to modify the image to your own need, implement a custom modifier class and add it to the configuration.