geniv / nette-configurator
Nette 框架的配置器和翻译组件
v4.2.8
2019-03-17 17:05 UTC
Requires
- php: >=7.0
- dibi/dibi: >=3.0
- geniv/nette-locale: >=2.0
- geniv/nette-search-content: >=1.0
- geniv/nette-translator: >=2.0
- nette/nette: >=2.4
- dev-master
- v4.2.8
- v4.2.7
- v4.2.6
- v4.2.5
- v4.2.4
- v4.2.3
- v3.2.3
- v3.2.2
- v3.1.2
- v3.1.1
- v3.1.0
- v3.0.1
- v3.0.0
- v2.2.1
- v2.2.0
- v2.1.9
- v2.1.8
- v2.1.7
- v2.1.6
- v2.1.5
- v2.1.4
- v2.1.3
- v2.1.2
- v2.1.1
- v2.1.0
- v2.0.4
- v2.0.3
- v2.0.2
- v2.0.1
- v2.0.0
- v1.1.2
- v1.1.1
- v1.1.0
- v1.0.9
- v1.0.8
- v1.0.7
- v1.0.6
- v1.0.5
- v1.0.4
- v1.0.3
- v1.0.2
- v1.0.1
- v1.0
- dev-develop
This package is auto-updated.
Last update: 2024-09-18 04:30:42 UTC
README
安装
$ composer require geniv/nette-configurator
或
"geniv/nette-configurator": "^4.0"
require
"php": ">=7.0", "nette/nette": ">=2.4", "dibi/dibi": ">=3.0", "geniv/nette-locale": ">=2.0", "geniv/nette-search-content": ">=1.0", "geniv/nette-translator": ">=2.0"
包含在应用程序中
可用的源驱动器
- DevNullDriver(默认值)
- DibiDriver(dibi + cache
_Configurator-DibiDriver
)
自翻译类
- ConfiguratorTranslator(cache
_Configurator-ConfiguratorTranslator
)
neon 配置
# configurator configurator: # debugger: true # autowired: true # driver: Configurator\Drivers\DevNullDriver driver: Configurator\Drivers\DibiDriver(%tablePrefix%) translator: false # searchMask: # - *Translation.neon searchPath: - %appDir%/presenters/AppTranslation.neon # excludePath: # - CustomExcludeTranslation.neon
neon 配置扩展
extensions: configurator: Configurator\Bridges\Nette\Extension
描述
内部组合 id_ident
和 id_locale
必须是唯一的!类型内容仅如 "category" 或 "flag of type"
内部数据在组件首次使用时加载。
可用接口: IConfigurator
使用
protected function createComponentConfig(IConfigurator $configurator): IConfigurator { // disable auto create ident //$configurator->setAutoCreate(false); return $configurator; }
$this['config']->isEnable('ident'): bool; $this['config']->getValue('ident'): mixed; // echo value of ident $this['config']->renderText('ident'); // return value of ident $this['config']->renderText('ident', true); // substitute logic $this['config']->renderText('ident', null, 'arg'); $this['config']->renderText('ident', null, ['arg']); // set data like translator $this['config']->setTranslator('ident', 'text'); $this['config']->setEditor('ident', 'new text'); $this['config']->getDataByIdent('ident');
使用
{control config:text 'web-title'} {control config:text 'web-title', true} {control config:text 'web-title', null, 'argument'} {control config:text 'web-title', null, ['argument']} <h1 n:if="$presenter['config']->isEnable('web-title')">{control config:text 'web-title'}</h1> <h1 n:if="$presenter['config']->getValue('show-web-title')">{control config:text 'web-title'}</h1> {* long equivalent - WHY?!: *} <h1 n:if="$presenter['config']->renderCheckbox('show-web-title', true)">{control config:text 'web-title'}</h1>