How do I access GET/POST from a view helper?

730 views Asked by At

I have a custom content element which uses a view-helper that inherits from link action. I want to use specific CSS when this link is "active". One way to do this would be to read _GET and check for link variables. Can I access _GET in a sane way from a view-helper? Or is there a better way?

Maybe this is impossible because the output of the view-helper will be cached...

I could of course access $_GET directly, but will this work with RealUrl?

1

There are 1 answers

1
biesior On BEST ANSWER

Of course you can, the same way as you would do it within controller:

$fooInGet    = \TYPO3\CMS\Core\Utility\GeneralUtility::_GET('foo');
$barInPost   = \TYPO3\CMS\Core\Utility\GeneralUtility::_POST('bar');
$zeeAnywhere = \TYPO3\CMS\Core\Utility\GeneralUtility::_GP('zee');