Skip to content

Instantly share code, notes, and snippets.

@astehlik
Created April 8, 2016 09:37
Show Gist options
  • Save astehlik/1990f63f19eecd3daa7f5514eee58178 to your computer and use it in GitHub Desktop.
Save astehlik/1990f63f19eecd3daa7f5514eee58178 to your computer and use it in GitHub Desktop.
Custom TYPO3 form field
<?php
// ...
$GLOBALS['TYPO3_CONF_VARS']['SYS']['formEngine']['nodeRegistry'][1460107841] = [
'nodeName' => 'tx_tinyurls_urldisplay',
'priority' => 40,
'class' => \Tx\Tinyurls\Hooks\UrlDisplayFormElement::class,
];
<?php
// TCA config ...
return [
// ...
'columns' => [
// ...
'urldisplay' => [
'config' => [
'type' => 'tx_tinyurls_urldisplay',
]
],
// ...
],
'types' => [
'0' => [
'showitem' => 'urldisplay...'
],
],
];
<?php
namespace Tx\Tinyurls\Hooks;
class UrlDisplayFormElement extends \TYPO3\CMS\Backend\Form\AbstractNode implements \TYPO3\CMS\Backend\Form\NodeInterface
{
/**
* Main render method
*
* @return array As defined in initializeResultArray() of AbstractNode
*/
public function render()
{
$result = $this->initializeResultArray();
$result['html'] = 'Hallo world!';
return $result;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment