Appendix A – PHP include scripts¶
ContentObjectRenderer¶
ContentObjectRenderer::cObjGetSingle(value, properties[, TSkey = '__'])
¶
A method of \TYPO3\
.
Gets a content object from the $conf
array.
Example:¶
$content = $cObjectRenderer->cObjGetSingle($conf['image'], $conf['image.'], 'My Image 2');
This would return any IMAGE cObject at the property image
of the
$conf
array for the include script!
ContentObjectRenderer::stdWrap(value, properties)
¶
A method of \TYPO3\
.
Hands the content in "value" to the stdWrap function, which will process it according to the configuration of the array "properties".
Example:¶
$content = $cObjectRenderer->stdWrap($content, $conf['stdWrap.']);
This will stdWrap the content with the properties of .std
of the
$conf
array!
TypoScriptFrontendController, TSFE¶
You can retrieve the \TYPO3\
via the request attribute
frontend.controller.
For instance, if you want to access the variable id
, you can do so by
writing: Typo
.
TypoScriptFrontendController->id¶
Changed in version 13.0
The property has been marked as read-only. Use
$request->get
instead. See Frontend page information.
-
id
¶ -
- Type
- integer
The current page id
TypoScriptFrontendController->type¶
Changed in version 13.0
The property has been removed with TYPO3 v13.0. See Migration
-
type
¶ -
- Type
- integer
Migration from $GLOBALS['TSFE']->type
¶
When using this property in PHP code via $GLOBALS
,
it is recommended to move to the
PSR-7 request via
$request->get
.
TypoScriptFrontendController->page¶
Changed in version 13.0
The property has been marked as read-only. Use
$request->get
instead. See Frontend page information.
-
page
¶ -
- Type
- array
The page record
TypoScriptFrontendController->feuser¶
Changed in version 13.0
The variable has been removed with TYPO3 v13. See Migration
-
fe_
¶user -
- Type
- array
The frontend user record
Migration: Use UserAspect or context instead of $GLOBALS['TSFE']->fe_user
¶
There are two possible migrations.
First, a limited information list of frontend user details can be
retrieved using the Context aspect
frontend.
in frontend calls. See class
\TYPO3\
for a full list. The current
context can be retrieved using
dependency injection.
Example:
<?php
declare(strict_types=1);
namespace MyVendor\MyExtension\Controller;
use TYPO3\CMS\Core\Context\Context;
final class MyExtensionController
{
public function __construct(
private readonly Context $context,
) {}
public function myAction()
{
$frontendUserUsername = $this->context->getPropertyFromAspect(
'frontend.user',
'username',
'',
);
}
}
Additionally, the full \TYPO3\
object is available as request attribute
frontend.user
in the frontend. Note some details of that object are marked
@internal
, using the context aspect is thus the preferred way.
Example of an extension using the Extbase's Action
:
<?php
declare(strict_types=1);
namespace MyVendor\MyExtension\Controller;
use Psr\Http\Message\ResponseInterface;
use TYPO3\CMS\Extbase\Mvc\Controller\ActionController;
final class MyExtensionController extends ActionController
{
public function myAction(): ResponseInterface
{
// Note the 'user' property is marked @internal.
$frontendUserUsername = $this->request
->getAttribute('frontend.user')->user['username'];
$this->view->assign('username', $frontendUserUsername);
return $this->htmlResponse();
}
}
TypoScriptFrontendController->rootLine¶
Changed in version 13.0
The property has been marked as read-only. Use
$request->get
instead. See Frontend page information.
-
root
¶Line -
- Type
- array
The root line (all the way to tree root, not only the current site!).
The current site root line is available via
$request->get
. See Frontend page information.Attribute ('frontend. page. information')->get Local Root Line () In TYPO3 versions before v13 the current site root line was only available via
\TYPO3\
.CMS\ Frontend\ Controller\ Typo Script Frontend Controller->config ['root Line']
TypoScriptFrontendController->table-row¶
Changed in version 13.0
The property has been marked as read-only. Avoid usages altogether,
create own instances of the
\TYPO3\
when needed.
-
root
¶Line -
- Type
- object
The object with page functions (object) See
EXT:
.core/ Classes/ Domain/ Repository/ Page Repository. php