[TYPO3-english] Powermail - prefill field using a hook

Brian Bendtsen bb at bellevuevej.dk
Thu Nov 13 19:47:33 CET 2008


Tapio Markula skrev:
> Brian Bendtsen kirjoitti:
>> Hi
>>
>> Im using powermail and need to prefill a textarea field with some data.
>>
>> I have been looking at the hooks and it looks like I can use this one 
>> PM_FieldWrapMarkerHook1
>>
>> But I dont see how I use it, can someone show me an example?
>>
>> I know the basics about using hooks, so you dont need to explain that 
>> part.
>>
>> So far I have tried this but without luck:
>>
>> function PM_FieldWrapMarkerHook1($uid, $xml, $type, $title, 
>> $markerArray, $piVarsFromSession, $obj) {
>>         if($markerArray['###POWERMAIL_FIELD_UID###'] == 5) {
>>             foreach($piVarsFromSession['uid5'] as $key=>$value) {
>>                 $markerArray['###VALUE###'] .= $value.'</br>';
>>             }
>>         }
>>     }
>>
>> /BB
> 
> you must pass $markerArray as reference
> 
> function PM_FieldWrapMarkerHook1($uid, $xml, $type, $title,
> &$markerArray, $piVarsFromSession, $obj) {
>  - if you do not do that the function doesn't do anything.
Ok, thanks

Now im getting somewhere, changed my function code to this:

function PM_FieldWrapMarkerHook1($uid, $xml, $type, $title, 
&$markerArray, $piVarsFromSession, $obj) {
		if($markerArray['###POWERMAIL_FIELD_UID###'] == 5) {
			//t3lib_div::devLog('test','wk_downloadcenter','',$type);
			foreach($piVarsFromSession['uid5'] as $key=>$value) {
				//$value .= $value.'</br>';
				$newValueField .= $value;
			}
			$markerArray['###VALUE###'] .= 'value="'.$newValueField.'" ';
		}
	}

But that leaves me with two value="" attributes, I thought the hook 
would replace the existing one. Any ideas?

/BB


More information about the TYPO3-english mailing list