tde / craft-environment-warning
This plugin has the ability to show a warning flash message on top of the website to warn the user he/she is visiting a non-production website.
This package's canonical repository appears to be gone and the package has been frozen as a result.
Installs: 2 058
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 5
Forks: 0
Open Issues: 0
Type:craft-plugin
Requires
- craftcms/cms: ^3.2
This package is auto-updated.
Last update: 2023-12-29 03:29:25 UTC
README
This plugin has the ability to show a warning flash message on top of the website to warn the user he/she is visiting a non-production website. This is useful when your website has multiple environments such as staging/test/accept alongside production. Often, clients keep working on non-production websites unintentionally after the website is live.
Additionally, when the website is deployed from a Git-repository, the current branch will also be shown.
Requirements
This plugin requires:
- Craft CMS 3.2 or later
Installation
This plugin can either be installed through the Plugin Store or using Composer.
Plugin Store
- In the Craft Control Panel, go to Settings -> Plugins
- Search for 'Environment Warning'
- Hit the "Install" button
Composer
-
Open your terminal and go to your Craft project:
cd /path/to/project
-
Download the plugin using Composer
composer require tde/craft-environment-warning
-
In the Craft Control Panel, go to Settings → Plugins
-
Hit the "Install" button for 'Environment Warning'.
Usage
The plugin will output a flash message by being called from a hook.
We recommend placing this hook at the top of your layout.html.twig
-file, straight after your opening body
-tag.
<html> <head> <title>Your fancy website</title> </head> <body> {% hook 'show-environment-warning' %} {# the rest of your site... #} {% block main %}{% endblock %} </body> </html>
To configure the flash message, the following Dot-Env settings can be used:
ENVIRONMENT_WARNING_ENABLED=true ENVIRONMENT_WARNING_PRODUCTION_URL="https://www.your-production-site.com"
Brought to you by TDE