Created
July 11, 2014 07:13
-
-
Save frans-beech-it/24bf64f3f43c44ff3f6a to your computer and use it in GitHub Desktop.
Add dynamic TCA field eval configuration
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ext_localconf.php | |
-------------------- | |
$GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_tceforms.php']['getSingleFieldClass'][$_EXTKEY] = | |
'EXT:' . $_EXTKEY . '/Classes/Hooks/Tceforms.php:Tx_Calendar_Hooks_Tceforms'; | |
Classes/Hooks/Tceforms.php | |
-------------------- | |
class Tx_Calendar_Hooks_Tceforms | |
{ | |
public function getSingleField_beforeRender($table, $field, &$row, &$PA) | |
{ | |
if ($table === 'tx_calendar_domain_model_event' && ($field == 'event_start' || $field == 'event_end')) { | |
if ($row['full_day']) { | |
$PA['fieldConf']['config']['eval'] = 'date,required'; | |
} else { | |
$PA['fieldConf']['config']['eval'] = 'datetime,required'; | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment