heimrichhannot / contao-be_hyperlink
此插件提供简单的后端超链接表单字段(文本链接或按钮)。
2.0.2
2021-04-15 15:08 UTC
Requires
- contao/core-bundle: ~4.1
Requires (Dev)
- contao/manager-plugin: ^2.0
- contao/test-case: ^1.1
- friendsofphp/php-cs-fixer: ^2.2
- php-http/guzzle6-adapter: ^1.1
- phpunit/phpunit: ^5.6|^6.0
- satooshi/php-coveralls: ^1.0
This package is not auto-updated.
Last update: 2024-09-15 01:13:09 UTC
README
此插件提供简单的后端超链接表单字段(文本链接或按钮)。
要检查与Contao 3的兼容性,请查看contao-3分支。
需求
- Contao 4(仅测试过4.4 LTS版本)
- PHP7(仅测试过PHP ^7.1版本)
技术说明
只需将字段添加到您的数据容器数组中,如下所示
$GLOBALS['TL_DCA']['tl_*']['fields']['myHyperlink'] = array
(
'label' => &$GLOBALS['TL_LANG']['tl_*']['myHyperlink'],
'inputType' => 'hyperlink',
'eval' => array(
'text' => &$GLOBALS['TL_LANG']['tl_*']['myHyperlinkText'], // string
'linkClass' => 'tl_submit', // use this for contao's button styling
'tl_class' => 'long',
'target' => '_blank',
// the url can be specified as string, callback array ora callable function
'url' => 'http://www.example.org',
'url' => ['MyClass', 'getUrl'],
'url' => function(\DataContainer $objDc) {
return sprintf('http://www.example.org?id=%s', $objDc->id);
}
)
);