I'm searching for a hook which is called after page creation or changes on pages like "hide page in nav
", "deactivate page
" or "move/delete page
"
Does someone know of one?
Thanks!
These Hooks are located in t3lib/class.t3lib_tcemain.php
The following are just some of those:
In your case, i think you could use "processDatamap_postProcessFieldArray".
Example how to include it in your ext_localconf.php:
$GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_tcemain.php']['processDatamapClass'][] = 'EXT:your_extension/hooks/class.tx_yourextension_tcemain.php:tx_yourextension_tcemain';
Example class:
<?php
class tx_yourextension_tcemain {
function processDatamap_postProcessFieldArray($status, $table, $id, &$fieldArray, &$pObj) {
if($table == 'pages' && $status =='new') {
// do some stuff
}
}
}
?>
With $table, you can check which table is modified. $status allows you to retrieve the current action, for example "new", "update" or "delete".
Example for TYPO3 > 6 with namespaces on another hook:
$GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['cms/tslib/class.tslib_menu.php']['filterMenuPages']['YourExtension\\Hook\\FilterMenuPages'] = 'EXT:your_extension/Classes/Hook/FilterMenuPages.php:YourExtension\Hook\FilterMenuPages';
For TYPO3 7.6 version (Also Works in 10.4.X as well)
Write following in ext_localconf.php
$GLOBALS ['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_tcemain.php']['processDatamapClass']['extkey'] = 'Vendor\\Extension\\Hook\\TCEmainHook';
$GLOBALS ['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_tcemain.php']['processCmdmapClass']['extkey'] = 'Vendor\\Extension\\Hook\\TCEmainHook';
Create hook class /Classes/Hook/TCEmainHook.php, Choose appropriate function from below list
<?php
namespace Vendor\Extension\Hook;
class TCEmainHook {
public function processCmdmap_preProcess($command, $table, $id, $value, \TYPO3\CMS\Core\DataHandling\DataHandler &$pObj) {}
public function processCmdmap_postProcess($command, $table, $id, $value, \TYPO3\CMS\Core\DataHandling\DataHandler &$pObj) {}
public function processDatamap_preProcessFieldArray(array &$fieldArray, $table, $id, \TYPO3\CMS\Core\DataHandling\DataHandler &$pObj) {}
public function processCmdmap_deleteAction($table, $id, $recordToDelete, $recordWasDeleted=NULL, \TYPO3\CMS\Core\DataHandling\DataHandler &$pObj) {}
public function processDatamap_afterAllOperations(\TYPO3\CMS\Core\DataHandling\DataHandler &$pObj) {}
public function processDatamap_postProcessFieldArray($status, $table, $id, array &$fieldArray, \TYPO3\CMS\Core\DataHandling\DataHandler &$pObj) {}
public function processDatamap_afterDatabaseOperations($status, $table, $id, array $fieldArray, \TYPO3\CMS\Core\DataHandling\DataHandler &$pObj) {}
}
There is a extension dmc_hooklist which list all hooks. (used a few years ago)
Or have an look into t3lib/class.t3lib_tcemain.php there are the hooks you need.