surgems/env-condition
最新稳定版本:2.0.0
Composer 安装命令:
composer require surgems/env-condition
包简介
Statamic Tag that only displays it's content in a selected environment.
README 文档
README
Env Condition is a Statamic Modifier that only displays it's content in a selected environment.
Features
This addon does:
- Allows you to display content/fields based on the
APP_ENV.
How to Install
You can use this addon by running the following command from your project root:
composer require surgems/env-condition
How to Use
This addons uses 3 environments:
- local
- staging
- production
Tag
You can display content inside the tag depending on the condition of the APP_ENV.
There are 2 tag Methods:
{{ if_env env="local" }}
{{ content | widont }}
{{ /if_env }}
This would display the content inside the tags if the APP_ENV IS 'local'.
{{ if_env:not env="local" }}
{{ content | widont }}
{{ /if_env:not }}
This would display the content inside the tags if the APP_ENV IS NOT 'local'.
You can also add multiple parameters:
{{ if_env:not env="local|staging" }}
{{ content | widont }}
{{ /if_env:not }}
This would display the content inside the tags if the APP_ENV IS NOT 'local' OR 'staging'.
Modifier
You can display a field whenever the APP_ENV is a certain environment.
There are 2 modifiers:
{{ field | if_env:local }}
This would display the field content if the APP_ENV IS equal to 'local'.
{{ field | if_env_not:local }}
This would display the field content if the APP_ENV IS NOT equal to 'local'.
You can also add multiple parameters:
{{ field | if_env:local:staging }}
统计信息
- 总下载量: 85
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 2
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2022-07-12