Project

General

Profile

Actions

Bug #43451

closed

Existing implementation of txCmsLayoutDrawItemHook fails in 6.0

Added by Martin Ficzel over 11 years ago. Updated over 10 years ago.

Status:
Closed
Priority:
Should have
Assignee:
-
Category:
-
Target version:
-
Start date:
2012-11-29
Due date:
% Done:

0%

Estimated time:
TYPO3 Version:
6.0
PHP Version:
5.3
Tags:
Complexity:
Is Regression:
Sprint Focus:

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


Related issues 2 (0 open2 closed)

Related to TYPO3 Core - Bug #40653: Namespace interfaces don't work for PHP version < 5.3.7 due to type hinting issuesClosed2012-09-05

Actions
Related to TYPO3 Core - Bug #42963: preProcess() hook invoking in some extensions in PageLayoutViewDrawItemHook failsClosed2012-11-14

Actions
Actions #1

Updated by Martin Ficzel over 11 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){
  }
}
Actions #2

Updated by Markus Klein over 11 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/

Actions #3

Updated by Thomas Maroschik over 11 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.

Actions #4

Updated by Ernesto Baschny over 11 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.

Actions #5

Updated by Alexander Opitz over 10 years ago

  • Status changed from Needs Feedback to Closed

No feedback for over 90 days.

Actions

Also available in: Atom PDF