Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 11 additions & 25 deletions Documentation/Conditions/Index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -839,37 +839,23 @@ compatVersion()
[END]


.. index:: Conditions; getTSFE
.. _condition-function-getTSFE:
.. _condition-function-getTSFE-migration:

getTSFE()
=========

.. confval:: getTSFE()
:name: condition-getTSFE
:type: Object

Provides access to :ref:`TypoScriptFrontendController <t3coreapi:tsfe>`
:php:`$GLOBALS['TSFE']`. This function can directly access methods of
:php:`TypoScriptFrontendController`. This class is target of a mid-term
refactoring. It should be used with care since it will eventually vanish in
the future.
getTSFE(): Migration
====================

Using the :typoscript:`getTSFE()` function, developers have to ensure that
"TSFE" is available before accessing its properties. A missing "TSFE", for
example, in backend context, does no longer automatically evaluate the whole
condition to :php:`false`. Instead, the function returns :php:`null`, which
can be checked using either :typoscript:`[getTSFE() && getTSFE().id == 17]`
or the null-safe operator :typoscript:`[getTSFE()?.id == 17]`.
.. versionchanged:: 14.0
`Breaking: #107473 - TypoScript condition function getTSFE() removed <https://docs.typo3.org/permalink/changelog:breaking-107473-1758113238>`_
The TypoScript condition function `getTSFE()` has been removed. Using a
condition like `getTSFE()` will never evaluate to true and needs adaption.

Example:

.. code-block:: typoscript
:caption: EXT:site_package/Configuration/TypoScript/setup.typoscript
.. code-block:: diff
:caption: EXT:site_package/Configuration/TypoScript/setup.typoscript (diff)

# True, if the current page UID is 17. Use the page variable instead
[getTSFE()?.id == 17]
- [getTSFE() && getTSFE().id == 42]

+ [request?.getPageArguments()?.getPageId() == 42]

.. index:: Conditions; getenv
.. _condition-function-getenv:
Expand Down
13 changes: 6 additions & 7 deletions Documentation/Syntax/Conditions/Index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -159,16 +159,15 @@ Using the null-safe operator in conditions
.. versionadded:: 12.1

Using the null-safe operator is possible when accessing properties on objects
which might not be available in some context, for example `TSFE` in the
backend:
which might not be available in some context, for example
`request() <https://docs.typo3.org/permalink/t3tsref:condition-function-request>`_
in the backend:

.. code-block:: typoscript
.. code-block:: diff

# Previously
# [getTSFE() && getTSFE().id == 123]
- [request && request.getPageArguments() && request.getPageArguments().getPageId() == 42]

# Now
[getTSFE()?.id == 123]
+ [request?.getPageArguments()?.getPageId() == 42]

.. _typoscript-syntax-syntax-value:

Expand Down