heimrichhannot / contao-be_hyperlink
This bundle offers a simple backend hyperlink form field (text link or button).
Installs: 39
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 5
Forks: 0
Type:contao-bundle
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-10-27 01:47:39 UTC
README
This bundle offers a simple backend hyperlink form field (text link or button).
For Contao 3 compability check out the contao-3 branch.
Requirements
- Contao 4 (only tested with 4.4 LTS)
- PHP7 (only tested with PHP ^7.1)
Technical instructions
Just add the field to some of your data container arrays as follows:
$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);
}
)
);