From 909db646363b4ce17c1000eb8133ddac76483b1c Mon Sep 17 00:00:00 2001 From: Steffen Kamper Date: Sat, 10 Apr 2010 21:15:39 +0000 Subject: [PATCH] Added feature #13953: Hookrequest - t3lib_page::getRecordOverlay (thanks to Tolleiv Nietsch) git-svn-id: https://svn.typo3.org/TYPO3v4/Core/trunk@7278 709f56b5-9817-0410-a4d7-c38de5d9e867 --- ChangeLog | 1 + t3lib/class.t3lib_page.php | 20 ++++++ t3lib/core_autoload.php | 1 + ....t3lib_pageselect_getrecordoverlayhook.php | 63 +++++++++++++++++++ 4 files changed, 85 insertions(+) create mode 100644 t3lib/interfaces/interface.t3lib_pageselect_getrecordoverlayhook.php diff --git a/ChangeLog b/ChangeLog index 58d6e98137a..b68ad63a406 100755 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,6 @@ 2010-04-10 Steffen Kamper + * Added feature #13953: Hookrequest - t3lib_page::getRecordOverlay (thanks to Tolleiv Nietsch) * Added feature #14041: impexp: Add Hooks * Added feature #13949: Hookrequest - alt_doc::makeEditForm() to enable further access-restrictions (thanks to Tolleiv Nietsch) * Added feature #13948: Hookrequest - tslib_fe pre/post process for settingLanguage() (thanks to Tolleiv Nietsch) diff --git a/t3lib/class.t3lib_page.php b/t3lib/class.t3lib_page.php index ec968763707..0383ef45460 100644 --- a/t3lib/class.t3lib_page.php +++ b/t3lib/class.t3lib_page.php @@ -380,6 +380,17 @@ class t3lib_pageSelect { function getRecordOverlay($table,$row,$sys_language_content,$OLmode='') { global $TCA; + if (is_array($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_page.php']['getRecordOverlay'])) { + foreach ($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_page.php']['getRecordOverlay'] as $classRef) { + $hookObject = t3lib_div::getUserObj($classRef); + + if (!($hookObject instanceof t3lib_pageSelect_getRecordOverlayHook)) { + throw new UnexpectedValueException('$hookObject must implement interface t3lib_pageSelect_getRecordOverlayHook', 1269881658); + } + $hookObject->getRecordOverlay_preProcess($table,$row,$sys_language_content,$OLmode, $this); + } + } + if ($row['uid']>0 && $row['pid']>0) { if ($TCA[$table] && $TCA[$table]['ctrl']['languageField'] && $TCA[$table]['ctrl']['transOrigPointerField']) { if (!$TCA[$table]['ctrl']['transOrigPointerTable']) { // Will not be able to work with other tables (Just didn't implement it yet; Requires a scan over all tables [ctrl] part for first FIND the table that carries localization information for this table (which could even be more than a single table) and then use that. Could be implemented, but obviously takes a little more....) @@ -436,7 +447,16 @@ class t3lib_pageSelect { } } } + if (is_array($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_page.php']['getRecordOverlay'])) { + foreach ($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_page.php']['getRecordOverlay'] as $classRef) { + $hookObject = t3lib_div::getUserObj($classRef); + if (!($hookObject instanceof t3lib_pageSelect_getRecordOverlayHook)) { + throw new UnexpectedValueException('$hookObject must implement interface t3lib_pageSelect_getRecordOverlayHook', 1269881659); + } + $hookObject->getRecordOverlay_postProcess($table,$row,$sys_language_content,$OLmode, $this); + } + } return $row; } diff --git a/t3lib/core_autoload.php b/t3lib/core_autoload.php index f087c11320b..ed1c9537aa2 100644 --- a/t3lib/core_autoload.php +++ b/t3lib/core_autoload.php @@ -112,6 +112,7 @@ return array( 't3lib_browselinkshook' => PATH_t3lib . 'interfaces/interface.t3lib_browselinkshook.php', 't3lib_localrecordlistgettablehook' => PATH_t3lib . 'interfaces/interface.t3lib_localrecordlistgettablehook.php', 't3lib_pageselect_getpagehook' => PATH_t3lib . 'interfaces/interface.t3lib_pageselect_getpagehook.php', + 't3lib_pageselect_getrecordoverlayhook' => PATH_t3lib . 'interfaces/interface.t3lib_pageselect_getrecordoverlayhook.php', 't3lib_pageselect_getpageoverlayhook' => PATH_t3lib . 'interfaces/interface.t3lib_pageselect_getpageoverlayhook.php', 't3lib_singleton' => PATH_t3lib . 'interfaces/interface.t3lib_singleton.php', 't3lib_tceformsinlinehook' => PATH_t3lib . 'interfaces/interface.t3lib_tceformsinlinehook.php', diff --git a/t3lib/interfaces/interface.t3lib_pageselect_getrecordoverlayhook.php b/t3lib/interfaces/interface.t3lib_pageselect_getrecordoverlayhook.php new file mode 100644 index 00000000000..2f7d37ee11d --- /dev/null +++ b/t3lib/interfaces/interface.t3lib_pageselect_getrecordoverlayhook.php @@ -0,0 +1,63 @@ + +* 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_pageSelect + * + * @author Tolleiv Nietsch + * @package TYPO3 + * @subpackage t3lib + */ + +interface t3lib_pageSelect_getRecordOverlayHook { + + /** + * Enables to preprocess a record overlay + * + * @param string $table + * @param array $row + * @param integer $sys_language_content + * @param string $OLmode + * @param t3lib_pageSelect $parent + */ + public function getRecordOverlay_preProcess($table, &$row, &$sys_language_content, $OLmode, t3lib_pageSelect $parent); + + /** + * Enables to postprocess a record overlay + * + * @param string $table + * @param array $row + * @param integer $sys_language_content + * @param string $OLmode + * @param t3lib_pageSelect $parent + */ + public function getRecordOverlay_postProcess($table, &$row, &$sys_language_content, $OLmode, t3lib_pageSelect $parent); + +} + +?> -- 2.20.1