Zum Inhalt springen

Hook beim Sortieren von Datensätzen

Erstellt am 31. Januar 2011 · 1 Antwort · letzte Antwort am 1. Februar 2011

Tags: Frage

Tacki ·

Hallo zusammen,

ich habe eine Extension erstellt und möchte eine Aktion ausführen, wenn die Datensätze im Backend sortiert werden. (sprich, der "Nach oben verschieben" bzw. "nach unten verschieben" Button gedrückt wird.
Dazu habe ich mich durch die Hooks gewühlt und bin der Meinung, dass ich auch schon auf der richtigen Spur bin, aber es funktioniert noch nicht. o.O

ext_localconf.php

<?php
if (!defined ('TYPO3_MODE')) {
 	die ('Access denied.');
}
$GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_tcemain.php']['moveRecordClass'][] = 'EXT:flashxml/class.flashxmlmove_hook.php:tx_flashxmlmove_hook';
?>

class.flashxmlmove_hook.php

<?php
class tx_flashxmlmove_hook {
	function moveRecord_afterAnotherElementPostProcess($table, $uid, $destPid, $origDestPid, $moveRec, $updateFields, $obj) {
	        var_dump('Test');
		// Do some action...
	}
		
	function moveRecord_firstElementPostProcess($table, $uid, $destPid, $moveRec, $updateFields, $obj) {
		$this->moveRecord_afterAnotherElementPostProcess($table, $uid, $destPid, null, $moveRec, $updateFields, $obj);
	}
}
?>
Tacki ·

ich habe mir meine Klassen nochmal genau angeschaut und jetzt klappt es doch! Ich bin mir nicht sicher, ob ich vorher einfach nur nicht genau hingeschaut habe, aber naja.... hier nochmal die Lösung, falls jemand anders auch mal diese Anforderung hat.

ext_localconf wie oben schon erwähnt

class.flashxmlmove_hook.php

<?php
class tx_flashxmlmove_hook {
	function moveRecord_afterAnotherElementPostProcess($table, $recordId, $destinationPid, $originalDestinationPid, $movedRecord, $updatedFields, $tceMain) {		
		if ($table == 'tx_flashxml_data') {
		        // Do some action...
		}
	}
		
	function moveRecord_firstElementPostProcess($table, $recordId, $destinationPid, $movedRecord, $updatedFields, $tceMain) {
		$this->moveRecord_afterAnotherElementPostProcess($table, $recordId, $destinationPid, array(), $movedRecord, $updateFields, $tceMain);
	}
}
?>