Bug #43451
closedExisting implementation of txCmsLayoutDrawItemHook fails in 6.0
0%
Description
If i implemment the following hook compatible with 4.x i get a fatal PHP-Error. Im running TYPO3 6.0 on php 5.3.6.
Error:
Fatal error: Declaration of tx_t3_default_resources_txCmsLayoutDrawItemHook::preProcess() must be compatible with that of TYPO3\CMS\Backend\View\PageLayoutViewDrawItemHookInterface::preProcess() in /Users/martin/Public/localhost/t3_default/www-data/typo3conf/ext/t3_default_resources/Classes/Hooks/txCmsLayoutDrawItemHook.php on line 4
Hook:
$GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['cms/layout/class.tx_cms_layout.php']['tt_content_drawItem']
Old implementation that fails in 6.0:
class tx_t3_default_resources_txCmsLayoutDrawItemHook implements tx_cms_layout_tt_content_drawItemHook { public function preProcess(tx_cms_layout &$parentObject, &$drawItem, &$headerContent, &$itemContent, array &$row){ } }
New namespaced implementation that works but is incompatible with 4.x:
class tx_t3_default_resources_txCmsLayoutDrawItemHook implements \TYPO3\CMS\Backend\View\PageLayoutViewDrawItemHookInterface { public function preProcess(tx_cms_layout &$parentObject, &$drawItem, &$headerContent, &$itemContent, array &$row){ } }
So currently it is not possible to implement this hook for 4.x and 6.0.
Regards Martin
Updated by Martin Ficzel almost 12 years ago
Sorry the correct implementation with the namespaced classes is here:
class tx_t3_default_resources_txCmsLayoutDrawItemHook implements \TYPO3\CMS\Backend\View\PageLayoutViewDrawItemHookInterface { public function preProcess(\TYPO3\CMS\Backend\View\PageLayoutView &$parentObject, &$drawItem, &$headerContent, &$itemContent, array &$row){ } }
Updated by Markus Klein almost 12 years ago
I fear you have to update your PHP version.
Minimum for TYPO3 CMS 6.0 is PHP 5.3.7
See also: https://typo3.org/download/
Updated by Thomas Maroschik almost 12 years ago
Could you try to skip the class path in the hook definition and put this information in the ext_autoload.php of the extension?
So instead writing "EXT:ext_xyz/Classes…/YourHookClass.php:YourHookClass" just "YourHookClass". By using the autoloader for the class the compatibility layer can kick in and rewrite the typehints.
Updated by Ernesto Baschny almost 12 years ago
- Status changed from New to Needs Feedback
This is probably the same issue as in #40653, the solution is also presented there in my comment 11. Please confirm so that we can close this. I would then add an additional note on that original issue that other hooks might also be affected that work in a similar way.
Updated by Alexander Opitz over 11 years ago
- Status changed from Needs Feedback to Closed
No feedback for over 90 days.