[TYPO3-dev] TCA Backend Input form Validation

Stephan Großberndt s.grossberndt at sidebysite.de
Fri Dec 5 14:48:10 CET 2014


You need a hook in ext_localconf.php

// Adds mobdb hooks to the tcemain
//  "processDatamapClass" = new, update
//  "processCmdmapClass" = move, copy, delete, undelete, localize, 
version etc.
$GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_tcemain.php']['processDatamapClass'][] 
= 
'EXT:myext/Classes/Service/TceMainHooks.php:Tx_Myext_Service_TceMainHooks';
$GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_tcemain.php']['processCmdmapClass'][] 
= 
'EXT:myext/Classes/Service/TceMainHooks.php:Tx_Myext_Service_TceMainHooks';

which may implement certain methods

myext/Classes/Service/TceMainHooks.php:

class Tx_Myext_Service_TceMainHooks {

	/**
	 * This method is called by a hook in the TYPO3 Core Engine (TCEmain) 
when a record is saved.
	 *
	 * @param	array		$fieldArray: The field names and their values to be 
processed
	 * @param	string		$table: The table TCEmain is currently processing
	 * @param	string		$id: The records id (if any)
	 * @param	object	$reference: Reference to the parent object (TCEmain)
	 * @return	void
	 * @access public
	 */
	function processDatamap_preProcessFieldArray(&$fieldArray, $table, $id, 
&$pObj) {
		
		if ($table == 'tx_myext_record' && !stristr($id, 'NEW') && 
$fieldArray['status'] == 'under_review') {
			// Send mail
		}

		if ($table == 'tx_myext_record' && $fieldArray['starttime'] > 
$fieldArray['endtime']) {
					$reference->log($table, $id, 2, 0, 1, 'starttime > endtime');
		}
	}

}



More information about the TYPO3-dev mailing list