Feature: #92984 - PSR-7 Request available in Frontend ContentObjects
See forge#92984
Description
The main Request object of a web-based PHP process is now handed into all
Content
and
Content
classes.
In addition, any kind of "userFunc" methods initiated from
Content
,
basically all custom Frontend PHP code, now receives the request object that was
handed in as third method argument.
The
Content
API now has a
get
method.
Example:
page.10 = USER
page.10.userFunc = MyVendor\MyPackage\Frontend\MyClass->myMethod
<?php
namespace MyVendor\MyPackage\Frontend;
class MyClass
{
public function myMethod(string $content, array $configuration, ServerRequestInterface $request)
{
$myValue = $request->getQueryParams()['myGetParameter'];
$normalizedParams = $request->getAttribute('normalizedParams');
}
}
This functionality should be used in PHP code related to Frontend code instead of
the superglobal variables like
$_
/
$_
/
$_
, or TYPO3s
API methods
General
and
General
.
Impact
Any kind of custom Content Object in PHP code can now access the PSR-7 Request object to fetch information about the current request, making TYPO3 Frontend aware of PSR-7 standardized request objects.