简体   繁体   中英

typolink userFunc in TYPO3 V8

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.

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM