Index: t3lib/class.t3lib_tcemain.php =================================================================== --- t3lib/class.t3lib_tcemain.php (revision 5105) +++ t3lib/class.t3lib_tcemain.php (working copy) @@ -361,6 +361,7 @@ var $autoVersioningUpdate = FALSE; // A signal flag used to tell file processing that autoversioning has happend and hence certain action should be applied. protected $disableDeleteClause = false; // Disable delete clause + protected $hookObjects = array(); // array containing instances of hook classes @@ -416,9 +416,36 @@ reset($cmd); $this->cmdmap = $cmd; } + + $this->initHookObjects(); } /** + * Initialized the hook objects for this class. + * Each hook object has to implement the interface t3lib_tcemainHook. + * + * @return void + */ + protected function initHookObjects() { + $this->hookObjects = array(); + if (isset($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_tceforms_inline.php']['tcemainHook'])) { + $tcemainHook =& $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_tceforms_inline.php']['tcemainHook']; + if (is_array($tcemainHook)) { + foreach($tcemainHook as $classData) { + $processObject = &t3lib_div::getUserObj($classData); + + if(!($processObject instanceof t3lib_tcemainHook)) { + throw new UnexpectedValueException('$processObject must implement interface t3lib_tcemainHook', 1235863561); + } + + $processObject->init($this); + $this->hookObjects[] = $processObject; + } + } + } + } + + /** * Function that can mirror input values in datamap-array to other uid numbers. * Example: $mirror[table][11] = '22,33' will look for content in $this->datamap[table][11] and copy it to $this->datamap[table][22] and $this->datamap[table][33] * @@ -4609,6 +4637,11 @@ } } + // Hook: versionSwap_postProcess + foreach ($this->hookObjects as $hookObj) { + $hookObj->versionSwap_postProcess($table, $id, $swapWith, $swapIntoWS); + } + if (!count($sqlErrors)) { // If a moving operation took place...: Index: t3lib/interfaces/interface.t3lib_tcemainhook.php =================================================================== --- t3lib/interfaces/interface.t3lib_tcemainhook.php (revision 0) +++ t3lib/interfaces/interface.t3lib_tcemainhook.php (revision 0) @@ -0,0 +1,59 @@ + + * All rights reserved + * + * This script is part of the TYPO3 project. The TYPO3 project is + * free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * The GNU General Public License can be found at + * http://www.gnu.org/copyleft/gpl.html. + * A copy is found in the textfile GPL.txt and important notices to the license + * from the author is found in LICENSE.txt distributed with these scripts. + * + * + * This script is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * This copyright notice MUST APPEAR in all copies of the script! + ***************************************************************/ + +/** + * Interface for classes which hook into t3lib_TCEmain. + * + * $Id: interface.interface.t3lib_tcemainhook.php + * + * @author Steffen Kamper + * @package TYPO3 + * @subpackage t3lib + */ +interface t3lib_tcemainHook { + /** + * Initializes this hook object. + * + * @param t3lib_TCEmain $parentObject: The calling t3lib_TCEmain object. + * @return void + */ + public function init(&$parentObject); + + /** + * Post-processing of versionSwap. + * + * @param string Table name + * @param integer UID of the online record to swap + * @param integer UID of the archived version to swap with! + * @param boolean If set, swaps online into workspace instead of publishing out of workspace. + * @return void + */ + public function versionSwap_postProcess($table, $id, $swapWith, $swapIntoWS); + + +} +?> \ No newline at end of file