1

I want to use the core linkhandler and change my link in a userFunc.

I use the linkhandler as it is described here, and it works with a single detail page: https://usetypo3.com/linkhandler.html

The problem is: If i change my typoscript to:

config.recordLinks {
    tx_news {
        typolink {
            userFunc = Vendor\Name\UserFunc\TypolinkUserFunc->parseLinkHandlerTypolink
            userFunc {
                newsUid = TEXT
                newsUid.data = field:uid

                newsClass = TEXT
                newsClass.data = parameters:class

                defaultDetailPid = 53
            }
        }
    }
}

it doesn't work.

I cannot address the userFunc. I'm in an extension. i use

'autoload' =>
        array(
            'psr-4' => array('Vendor\\Name\\' => 'Classes')
        ),
);

in order to load my userFunc Class. I do not get any error message.

Markus Dübbert
  • 213
  • 2
  • 12
  • The class file is my_ext/Classes/UserFunc/TypolinkUserFunc.php? And how does the class look like (full source)? Does it work without the config.recordLinks context, e.g. page.10 = USER_INT, page.10.userFunc = Vendor\Name\UserFunc\TypolinkUserFunc->parseLinkHandlerTypolink ? Otherwise use a debugger and set a breakpoint in sysext/frontend/Classes/ContentObject/ContentObjectRenderer.php line 5712. – Wolfgang Oct 20 '17 at 07:28
  • Did you read the documentation for userFunc in typolink? https://docs.typo3.org/typo3cms/TyposcriptReference/Functions/Typolink/Index.html?highlight=typolink. Can you also post your code of the userFunc? – Thomas Löffler Oct 26 '17 at 12:57

1 Answers1

-1

You must have figured it out by now, but you have to run a userFunc as USER.

10 = USER
10 {
    userFunc = TYPO3\Extension\Sample->user_exampleUserFunc
}

So as a sample, your code should look something like this:

config.recordLinks {
    tx_news {
        typolink {
            10 = USER
            10 {
                userFunc = Vendor\Name\UserFunc\TypolinkUserFunc->parseLinkHandlerTypolink
                userFunc {
                    newsUid = TEXT
                    newsUid.data = field:uid

                    newsClass = TEXT
                    newsClass.data = parameters:class

                    defaultDetailPid = 53
                }
            }
        }
    }
}

As the above is just an example, it should get you started.

Franky W.
  • 178
  • 3
  • 17