2
votes

i want to use the userFunc to rewrite a link when it as the class "button". So my Config: Setup TS:

includeLibs.userFunc= fileadmin/userfunc/typolink.php
tt_content.text.20.parseFunc.tags.link.postUserFunc = user_userFunc->addButton
tt_content.text.20.parseFunc.tags.link.postUserFunc.class = button
tt_content.text.20.parseFunc.tags.link.postUserFunc.ATagTitle.field = title

and in my typolink file:

<?php
class user_userFunc{
function addButton($content,$conf) {
    $class = $conf['class'];

    if (preg_match('/class\="(.*'. $class .'.*)"/i', $content, $res)) {
      $content = preg_replace('@>(.*)</a>@i', '><div class="btn-group"><div class="btn-txt">$1</div><div class="btn-icon"><span style="width: 17px; height:17px;" class="wbt-icon wbt-weiter"></span></div></div></a>', $content);
    }
    #$content = "TEST TEST TEST";
    return $content;
}
} 

So i added Links with the button class. As i can see in the frontend they have the button class two. But my Methods are not starting.

Hope some of you have an idea how to fix it.

Typo3 version 6.2.14

1
Which TYPO3-version are you using? The includeLibs setting has been removed in TYPO3 7.4, maybe that is the cause? - Jost
Hi it is version 6.2.14 - Hackbard

1 Answers

0
votes

You should not name the class user_userFunc. I'm not sure, but I can remember hitting something like that in the past.

Try renaming the class to user_rteHelper or something and also name the file identically to the class name e.g. user_rteHelper.php.