This extension documentation is published under the
CC BY-NC-SA 4.0
(Creative Commons) license.
This extension provides several features to show an environment indicator in the TYPO3 frontend and backend.
Introduction
A quick overview about the main features provided by this extension.
Installation
Instructions on how to install this extension and which TYPO3 and PHP versions are currently supported.
Configuration
Learn how to configure the extension in various ways. This includes extension configuration and the usage of the configuration utility.
Indicators
Indicators are the main feature of this extension. They are used to show e.g. the current application context in the frontend and backend.
Triggers
Triggers are conditions that can be used to show or hide the environment indicator in the frontend and backend.
Developer corner
A quick overview of the possibilities for extending the extension
Introduction
What does it do?
This extension provides several features to show an environment indicator in the TYPO3 frontend and backend.
Note
These environment indicators are mainly for development purposes (e.g. distinguishing between different test systems) and will not show in production environments.
Features
Combine trigger and indicator classes to show the environment in the TYPO3 frontend and backend. The extension provides several trigger and indicator classes out of the box. You can also create your own trigger and indicator classes.
Backend with several environment indicators
Image
Description
Frontend
Backend
Frontend Hint: Adds an informative hint to the frontend showing the website title and current environment.
✔️
Backend toolbar item: Adds an informative item to the backend toolbar showing the current environment.
✔️
Backend topbar: Colors the backend header topbar according to the environment.
✔️
Modified favicon: Modifies the favicon for frontend and backend based on the original favicon, current environment and your configuration.
✔️
✔️
Modified backend logo: Modifies the backend logo based on the original logo, current environment and your configuration.
✔️
Dashboard widget: Render a dashboard widget according to the environment.
✔️
Modified frontend image: Modifies the frontend image based on the original image, current environment and your configuration.
✔️
Support
There are several ways to get support for this extension:
Go to Admin Tools > Settings > Extension Configuration
Choose typo3_environment_indicator
The extension currently provides the following configuration options:
General
general.imageDriver
general.imageDriver
Type
option
Default
"gd"
Intervention Image supports "GD Library", "Imagick" and "libvips" to process images internally. You may choose one of them according to your PHP configuration. Options are "gd", "imagick" and "vips".
general.defaultConfiguration
general.defaultConfiguration
Type
boolean
Default
1
Enable the default configuration for the environment indicators. If you want to configure the environment indicators by yourself, set this to false. See Configuration.
Frontend
frontend.favicon
frontend.favicon
Type
boolean
Default
1
Enable the favicon generation in frontend context
frontend.context
frontend.context
Type
boolean
Default
1
Enable the context frontend hint
Backend
backend.favicon
backend.favicon
Type
boolean
Default
1
Enable the favicon generation in backend context
backend.logo
backend.logo
Type
boolean
Default
1
Enable the logo generation in backend context
backend.context
backend.context
Type
boolean
Default
1
Enable the context item within the backend toolbar
backend.contextProduction
backend.contextProduction
Type
boolean
Default
1
Enable the backend toolbar item / backend topbar also in production context
Handler
The Handler class is used to register the indicators and triggers in the TYPO3 backend. The class provides a static method addIndicator() to add the indicators and triggers to the system.
The backend toolbar item will show the current project version and environment.
Backend toolbar item
You can adjust the color of the toolbar item in your ext_localconf.php:
ext_localconf.php
useKonradMichalik\Typo3EnvironmentIndicator\Configuration\Handler;
useKonradMichalik\Typo3EnvironmentIndicator\Configuration\Indicator;
useKonradMichalik\Typo3EnvironmentIndicator\Configuration\Trigger;
Configuration\Handler::addIndicator(
triggers: [
new Trigger\ApplicationContext('Testing')
],
indicators: [
new Indicator\Backend\Toolbar([
'color' => '#bd593a',
])
]
);
Copied!
Additional optional configuration keys:
text (string): The text of the toolbar item. Default is the application context.
icon (string): The icon of the toolbar item. Default is information-application-context.
index (int): The positioning index of the toolbar item. Default is 0.
Note
The backend toolbar item is a feature, which can also be shown in production context. Use the extension settings to enable, disable or restrict it.
Backend topbar
The backend toolbar item will show the current project version and environment.
Backend topbar
You can adjust the color of the topbar in your ext_localconf.php:
ext_localconf.php
useKonradMichalik\Typo3EnvironmentIndicator\Configuration\Handler;
useKonradMichalik\Typo3EnvironmentIndicator\Configuration\Indicator;
useKonradMichalik\Typo3EnvironmentIndicator\Configuration\Trigger;
Configuration\Handler::addIndicator(
triggers: [
new Trigger\ApplicationContext('Testing')
],
indicators: [
new Indicator\Backend\Topbar([
'color' => '#bd593a',
])
]
);
Copied!
Additional optional configuration keys:
removeTransition (bool): With this option you can remove the color to black transition on the right side of the topbar (not relevant for v13). Default is false.
Note
The backend topbar is a feature, which can also be shown in production environments. Use the extension settings to enable, disable or restrict it.
Favicon
The favicon of the frontend or backend context will be modified regarding the environment and the associated
configuration.
For the frontend, the original favicon will either be fetched from the typoscript configuration
page.shortcutIcon (see typoscript reference)
or can be handled by your own fluid template via the FaviconViewHelper:
The modifiers will be executed one after the other. You can combine them if you want.
Note
If you want to specify the frontend or backend favicon separately, you can add the another parameter for the request context faviconModifierFrontendConfiguration or faviconModifierBackendConfiguration to the configByContext() method.
The following modifier classes are available:
TextModifier
This is the default modifier if no own configuration is set.
If you want to modify the image to your own need, implement a custom modifier class and add it to the configuration.
Backend Logo
The backend logo will be modified regarding the environment and the associated
configuration. This can be used to e.g. show the current environment in the website logo.
Backend Logo Example
The backend logo will be fetched by the extension configuration of
$GLOBALS['TYPO3_CONF_VARS']['EXTENSIONS']['backend']['backendLogo'].
Modifiers
The backend logo modification is identical to the favicon modification. You can use the same modifiers and configuration.
The Admin trigger is used to show the indicators in the TYPO3 backend for admin users.
ext_localconf.php
\KonradMichalik\Typo3EnvironmentIndicator\Configuration\Handler::addIndicator(
triggers: [
new \KonradMichalik\Typo3EnvironmentIndicator\Configuration\Trigger\Admin()
],
indicators: [
new \KonradMichalik\Typo3EnvironmentIndicator\Configuration\Indicator\Backend\Topbar([
'color' => '#00ACC1',
]),
]
);
Copied!
Application Context
The ApplicationContext trigger is used to show the indicators in the TYPO3 backend for a specific application context.
ext_localconf.php
\KonradMichalik\Typo3EnvironmentIndicator\Configuration\Handler::addIndicator(
triggers: [
new \KonradMichalik\Typo3EnvironmentIndicator\Configuration\Trigger\ApplicationContext('Development*', 'Testing')
],
indicators: [
new \KonradMichalik\Typo3EnvironmentIndicator\Configuration\Indicator\Backend\Topbar([
'color' => '#00ACC1',
]),
]
);
Copied!
The configuration supports multiple context names, which are separated by a comma. The context names can be prefixed with a wildcard * to match all contexts that start with the given name. For example, Development* will match all contexts that start with Development, such as Development, Development/Local, Development/DDEV, etc.
Backend User Group
The BackendUserGroup trigger is used to show the indicators in the TYPO3 backend for specific backend user groups.
ext_localconf.php
\KonradMichalik\Typo3EnvironmentIndicator\Configuration\Handler::addIndicator(
triggers: [
new \KonradMichalik\Typo3EnvironmentIndicator\Configuration\Trigger\BackendUserGroup(1,2)
],
indicators: [
new \KonradMichalik\Typo3EnvironmentIndicator\Configuration\Indicator\Backend\Topbar([
'color' => '#00ACC1',
]),
]
);
Copied!
The configuration supports multiple group IDs, which are separated by a comma.
Custom
The Custom trigger is used to show the indicators in the TYPO3 backend for custom conditions.
ext_localconf.php
\KonradMichalik\Typo3EnvironmentIndicator\Configuration\Handler::addIndicator(
triggers: [
new \KonradMichalik\Typo3EnvironmentIndicator\Configuration\Trigger\Custom(
function(){
returntrue;
}
),
new \KonradMichalik\Typo3EnvironmentIndicator\Configuration\Trigger\Custom('\YourExtension\YourClass::yourMethod()'),
],
indicators: [
new \KonradMichalik\Typo3EnvironmentIndicator\Configuration\Indicator\Backend\Topbar([
'color' => '#00ACC1',
]),
]
);
Copied!
The configuration supports a callable function, which is executed to determine if the indicator should be shown. The function should return a boolean value. The function can also be a closure or an anonymous function.
Frontend User Group
The FrontendUserGroup trigger is used to show the indicators in the TYPO3 Frontend for specific frontend user groups.
ext_localconf.php
\KonradMichalik\Typo3EnvironmentIndicator\Configuration\Handler::addIndicator(
triggers: [
new \KonradMichalik\Typo3EnvironmentIndicator\Configuration\Trigger\FrontendUserGroup(1,2)
],
indicators: [
new \KonradMichalik\Typo3EnvironmentIndicator\Configuration\Indicator\Backend\Topbar([
'color' => '#00ACC1',
]),
]
);
Copied!
The configuration supports multiple group IDs, which are separated by a comma.
IP Address
The IP trigger is used to show the indicators in the TYPO3 backend for specific IP addresses.
ext_localconf.php
\KonradMichalik\Typo3EnvironmentIndicator\Configuration\Handler::addIndicator(
triggers: [
new \KonradMichalik\Typo3EnvironmentIndicator\Configuration\Trigger\Ip('127.0.0.1', '192.168.0.0/24')
],
indicators: [
new \KonradMichalik\Typo3EnvironmentIndicator\Configuration\Indicator\Backend\Topbar([
'color' => '#00ACC1',
]),
]
);
Copied!
The configuration supports multiple ip addresses, which are separated by a comma. Ip ranges are also supported, e.g. 0/24.
Developer corner
Some kinds of the environment indicators are configurable or can be extended
with custom implementations. This section provides an insight into
which development options are available and how these can be integrated
into the generation process.
Having fun with colorful favicons? Use the ColorUtility::getColoredString()
function as color entry in your modifier configuration to generate a color based on a string (default is the
$GLOBALS['TYPO3_CONF_VARS']['SYS']['sitename']).
Example
The following configuration is also the default configuration. This shall show the usage of the extension.
ext_localconf.php
useKonradMichalik\Typo3EnvironmentIndicator\Configuration\Handler;
useKonradMichalik\Typo3EnvironmentIndicator\Configuration\Indicator;
useKonradMichalik\Typo3EnvironmentIndicator\Configuration\Trigger;
useKonradMichalik\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,
],
])
]),
new Indicator\Frontend\Hint([
'color' => '#bd593a',
]),
new Indicator\Backend\Toolbar([
'color' => '#bd593a',
])
]
);
Handler::addIndicator(
triggers: [
new Trigger\ApplicationContext('Testing*')
],
indicators: [
new Indicator\Favicon([
new Image\Modifier\TextModifier([
'text' => 'TEST',
'color' => '#f39c12',
'stroke' => [
'color' => '#ffffff',
'width' => 3,
],
])
]),
new Indicator\Frontend\Hint([
'color' => '#f39c12',
]),
new Indicator\Backend\Toolbar([
'color' => '#f39c12',
])
]
);
Handler::addIndicator(
triggers: [
new Trigger\ApplicationContext('Production/Staging', 'Production/Stage')
],
indicators: [
new Indicator\Favicon([
new Image\Modifier\TextModifier([
'text' => 'STG',
'color' => '#2f9c91',
'stroke' => [
'color' => '#ffffff',
'width' => 3,
],
])
]),
new Indicator\Frontend\Hint([
'color' => '#2f9c91',
]),
new Indicator\Backend\Toolbar([
'color' => '#2f9c91',
])
]
);
Handler::addIndicator(
triggers: [
new Trigger\ApplicationContext('Production/Standby')
],
indicators: [
new Indicator\Backend\Toolbar([
'color' => '#2f9c91',
])
]
);
Copied!
Reference to the headline
Copy and freely share the link
This link target has no permanent anchor assigned.The link below can be used, but is prone to change if the page gets moved.