[TYPO3] pbsurvey - hook

Henjo Hoeksma hphoeksma at stylence.nl
Wed Aug 6 14:35:11 CEST 2008


On 2008-08-06 14:14:08 +0200, "Dmitry Dulepov [typo3]" <dmitry at typo3.org> said:

> Hi!
> 
> Henjo Hoeksma wrote:
>> thank you for replying. Could you point out where I can find more 
>> background info on how to use this construction of &$pObj ? I feel 
>> kinda lost :-(
> 
> Replace $this with &$pObj:
> 
> function hookItemProcessor($arrItem, &$pObj) {
> 
> I am not sure about background info...

Hi Dmitry,

again thanks for your response.
It seemed too obvious for me that this would work - and resulting in the error:

Call to a member function hookItemProcessor() on a non-object

it seemed I must have overlooked something.

My code displayed out here:

The hook (from pbsurvey)
###
function callHook($arrItem) {
    	if 
(is_array($GLOBALS['TYPO3_CONF_VARS']['EXTCONF'][$this->extKey][$this->prefixId]['processHookItem'])) 
{
			foreach($GLOBALS['TYPO3_CONF_VARS']['EXTCONF'][$this->extKey][$this->prefixId]['processHookItem'] 
as $_classRef) {
				$_procObj = & t3lib_div::getUserObj($_classRef);
				$strOutput = $_procObj->hookItemProcessor($arrItem, $this);
			}
			return $strOutput;
    	}
    }
###

My class (license stripped) class.kopbsurveyext.php
###
<?php

class tx_kopbsurveyext {
	
	function hookItemProcessor($arrItem,&$pObj) {
		$content = "test";
		return $content;
	}

}

?>
###

My ext_localconf.php
###
<?php

if (!defined ("TYPO3_MODE")) 	die ("Access denied.");

if(TYPO3_MODE != 'BE') {
  
require_once(t3lib_extMgm::extPath('kopbsurveyext').'class.kopbsurveyext.php');
}


$TYPO3_CONF_VARS['EXTCONF']['pbsurvey']['tx_pbsurvey_pi1']['processHookItem'][] 

= 'EXT:kopbsurveyext/class.kopbsurveyext.php:tx_kopbsurveyext';

?>
###

Do I miss something else??

-- 
Met vriendelijke groet, kinds regards,

Henjo Hoeksma
Stylence | 2b launched soon!
www.stylence.nl



More information about the TYPO3-english mailing list