Last active
April 20, 2017 11:06
-
-
Save benjaminrau/3b27a6bc6cdd112afac2 to your computer and use it in GitHub Desktop.
How to have a tca field of type float/double but nullable
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
<?php | |
class Double2With4DecimalsFormat { | |
function returnFieldJS() { | |
return ' | |
return value.replace(",", "."); | |
'; | |
} | |
function evaluateFieldValue($value, $is_in, &$set) { | |
if ('' == $value) { | |
return NULL; | |
} | |
return sprintf('%01.4f', $value); | |
} | |
} |
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
<?php | |
$TYPO3_CONF_VARS['SC_OPTIONS']['tce']['formevals']['Double2With4DecimalsFormat'] = 'EXT:nmidbproducts/Classes/Formevals/Double2With4DecimalsFormat.php'; |
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
index_value double(11,4) DEFAULT NULL, |
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
<?php | |
'index_value' => array( | |
'exclude' => 1, | |
'label' => 'LLL:EXT:nmidbproducts/Resources/Private/Language/locallang_db.xlf:tx_nmidbproducts_domain_model_fructose.index_value', | |
'config' => array( | |
'type' => 'input', | |
'size' => 30, | |
'eval' => 'Double2With4DecimalsFormat' | |
) | |
), |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment