Skip to content

Instantly share code, notes, and snippets.

@a-r-m-i-n
Last active August 29, 2015 14:14
Show Gist options
  • Select an option

  • Save a-r-m-i-n/c91d5a0e313a44217c9b to your computer and use it in GitHub Desktop.

Select an option

Save a-r-m-i-n/c91d5a0e313a44217c9b to your computer and use it in GitHub Desktop.
UserFields for TYPO3 (TCA)
<?php
class tx_ext_myCustomField {
/**
* @var array Field parameters
*/
protected $parameter = array();
/**
* @param $parameter
* @return string
*/
function getMyCustomField($parameter) {
$isCool = $parameter['fieldConf']['config']['parameters']['isCool'];
return '<div>The HTML of your field</div>';
}
}
<?php
if (!defined('TYPO3_MODE')) {
die ('Access denied.');
}
if (TYPO3_MODE === 'BE') {
require_once(t3lib_extMgm::extPath($_EXTKEY).'Classes/UserFunction/class.tx_ext_myCustomField.php');
}
<?php
if (!defined ('TYPO3_MODE')) {
die ('Access denied.');
}
$TCA['tx_ext_domain_model_whatever'] = array(
'ctrl' => $TCA['tx_ext_domain_model_whatever']['ctrl'],
'interface' => array(
'showRecordFieldList' => 'sys_language_uid, l10n_parent, l10n_diffsource, hidden',
),
'types' => array(
'1' => array('showitem' => 'hidden;;1,myCoolNewOwnField'),
),
'palettes' => array(
'1' => array('showitem' => ''),
),
'columns' => array(
'template_content' => array(
'exclude' => 0,
'label' => 'My cool new own field',
'config' => array (
'type' => 'user',
'userFunc' => 'EXT:ext/Classes/UserFunction/class.tx_ext_myCustomField.php:tx_ext_myCustomField->getMyCustomField',
'parameters' => array(
'isCool' => TRUE
),
),
),
),
);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment