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

Tapio Markula tapio.markula at xetpoint.fi
Thu Nov 13 20:17:15 CET 2008


Brian Bendtsen
> 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?

of course that does because you have used '.=' and 
'$piVarsFromSession['uid5']' has several keys.
'.=' adds new after existing string.

for replacing one value you don't need foreach but just
$markerArray['###VALUE###'] = 
'value="'.$piVarsFromSession['uid5']['someKey'].'" ';


More information about the TYPO3-english mailing list