我正在搜索在页面创建后调用的挂钩或在“hide page in nav
”,“deactivate page
”或“move/delete page
”
有人知道吗?
谢谢!
答案 0 :(得分:19)
这些挂钩位于t3lib/class.t3lib_tcemain.php
以下是其中一些:
在您的情况下,我认为您可以使用“ processDatamap_postProcessFieldArray ”。
如何将其包含在 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';
示例类:
<?php
class tx_yourextension_tcemain {
function processDatamap_postProcessFieldArray($status, $table, $id, &$fieldArray, &$pObj) {
if($table == 'pages' && $status =='new') {
// do some stuff
}
}
}
?>
使用 $ table ,您可以检查修改了哪个表。 $ status 可让您检索当前操作,例如“新”,“更新”或“删除”。
TYPO3的例子&gt; 6在另一个钩子上有命名空间:
$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';
答案 1 :(得分:4)
TYPO3 7.6 版本
在 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';
创建钩子类 /Classes/Hook/TCEmainHook.php ,从下面的列表中选择适当的功能
<?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) {}
}
答案 2 :(得分:-1)
有一个扩展名dmc_hooklist,其中列出了所有挂钩。 (几年前使用过)
或者看一下t3lib / class.t3lib_tcemain.php,你需要它们。