Skip to content

Commit

Permalink
[TASK] Show full conditions in examples (#1163)
Browse files Browse the repository at this point in the history
A condition consists not only of the - well - condition itself, but also the marking of the end of a condition is important. This is now added, some examples already have the end marker.

Releases: main, 12.4
  • Loading branch information
brotkrueml authored Mar 29, 2024
1 parent a089ded commit bbd018e
Showing 1 changed file with 104 additions and 1 deletion.
105 changes: 104 additions & 1 deletion Documentation/Conditions/Index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -57,10 +57,14 @@ applicationContext
:caption: EXT:site_package/Configuration/TypoScript/setup.typoscript
[applicationContext == "Development"]
# ...
[END]
# Any context that is "Production" or starts with "Production"
# (for example, Production/Staging").
[applicationContext matches "/^Production/"]
# ...
[END]
.. index:: Conditions; page
Expand All @@ -83,22 +87,36 @@ page
# Check single page UID
[traverse(page, "uid") == 2]
# ...
[END]
# Check list of page UIDs
[traverse(page, "uid") in [17,24]]
# ...
[END]
# Check list of page UIDs NOT in
[traverse(page, "uid") not in [17,24]]
# ...
[END]
# Check range of pages (example: page UID from 10 to 20)
[traverse(page, "uid") in 10..20]
# ...
[END]
# Check the page backend layout
[traverse(page, "backend_layout") == 5]
# ...
[END]
[traverse(page, "backend_layout") == "example_layout"]
# ...
[END]
# Check the page title
[traverse(page, "title") == "foo"]
# ...
[END]
.. index:: Conditions; tree
Expand Down Expand Up @@ -139,6 +157,8 @@ tree.level
# Check, if the page is on level 0:
[tree.level == 0]
# ...
[END]
.. index:: Conditions; tree.pagelayout
Expand All @@ -162,9 +182,13 @@ tree.pagelayout
# Using backend layout records
[tree.pagelayout == 2]
# ...
[END]
# Using the TSconfig provider of backend layouts
[tree.pagelayout == "pagets__Home"]
# ...
[END]
.. index::
Expand All @@ -187,6 +211,8 @@ tree.rootLine
:caption: EXT:site_package/Configuration/TypoScript/setup.typoscript
[tree.rootLine[0]["uid"] == 1]
# ...
[END]
.. index::
Expand All @@ -211,6 +237,8 @@ tree.rootLineIds
# Check, if page with uid 2 is inside the root line
[2 in tree.rootLineIds]
# ...
[END]
.. index::
Expand All @@ -235,6 +263,8 @@ tree.rootLineParentIds
# Check, if the page with UID 2 is the parent of a page inside the root line
[2 in tree.rootLineParentIds]
# ...
[END]
.. index:: Conditions; backend
Expand Down Expand Up @@ -287,6 +317,8 @@ backend.user.isAdmin
# Evaluates to true, if the current backend user is administrator
[backend.user.isAdmin]
# ...
[END]
.. index:: Conditions; backend.user.isLoggedIn
Expand All @@ -309,6 +341,8 @@ backend.user.isLoggedIn
# Evaluates to true, if a backend user is logged in
[backend.user.isLoggedIn]
# ...
[END]
.. index:: Conditions; backend.user.userId
Expand All @@ -332,6 +366,8 @@ backend.user.userId
# Evaluates to true, if the user UID of the current logged-in backend
# user is equal to 5
[backend.user.userId == 5]
# ...
[END]
.. index:: Conditions; backend.user.userGroupIds
Expand All @@ -354,6 +390,8 @@ backend.user.userGroupIds
:caption: EXT:site_package/Configuration/TypoScript/setup.typoscript
[2 in backend.user.userGroupIds]
# ...
[END]
.. index:: Conditions; backend.user.userGroupList
Expand All @@ -375,6 +413,8 @@ backend.user.userGroupList
:caption: EXT:site_package/Configuration/TypoScript/setup.typoscript
[like(","~backend.user.userGroupList~",", "*,1,*")]
# ...
[END]
.. index:: Conditions; frontend
Expand Down Expand Up @@ -424,6 +464,8 @@ frontend.user.isLoggedIn
:caption: EXT:site_package/Configuration/TypoScript/setup.typoscript
[frontend.user.isLoggedIn]
# ...
[END]
.. index:: Conditions; frontend.user.userId
Expand All @@ -445,6 +487,8 @@ frontend.user.userId
:caption: EXT:site_package/Configuration/TypoScript/setup.typoscript
[frontend.user.userId == 5]
# ...
[END]
.. index:: Conditions; frontend.user.userGroupIds
Expand All @@ -467,6 +511,8 @@ frontend.user.userGroupIds
:caption: EXT:site_package/Configuration/TypoScript/setup.typoscript
[4 in frontend.user.userGroupIds]
# ...
[END]
.. index:: Conditions; frontend.user.userGroupList
Expand All @@ -488,6 +534,8 @@ frontend.user.userGroupList
:caption: EXT:site_package/Configuration/TypoScript/setup.typoscript
[like(","~frontend.user.userGroupList~",", "*,1,*")]
# ...
[END]
.. index:: Conditions; workspace
Expand Down Expand Up @@ -524,6 +572,8 @@ workspace.workspaceId
# Check, if in live workspace
[workspace.workspaceId == 0]
# ...
[END]
.. index:: Conditions; workspace.isLive
Expand All @@ -545,6 +595,8 @@ workspace.isLive
:caption: EXT:site_package/Configuration/TypoScript/setup.typoscript
[workspace.isLive]
# ...
[END]
.. index:: Conditions; workspace.isOffline
Expand All @@ -566,6 +618,8 @@ workspace.isOffline
:caption: EXT:site_package/Configuration/TypoScript/setup.typoscript
[workspace.isOffline]
# ...
[END]
.. index:: Conditions; typo3
Expand Down Expand Up @@ -601,6 +655,8 @@ typo3.version
:caption: EXT:site_package/Configuration/TypoScript/setup.typoscript
[typo3.version == "12.4.5"]
# ...
[END]
.. index:: Conditions; typo3.branch
Expand All @@ -622,6 +678,8 @@ typo3.branch
:caption: EXT:site_package/Configuration/TypoScript/setup.typoscript
[typo3.branch == "12.4"]
# ...
[END]
.. index:: Conditions; typo3.devIpMask
Expand All @@ -643,6 +701,8 @@ typo3.devIpMask
:caption: EXT:site_package/Configuration/TypoScript/setup.typoscript
[typo3.devIpMask == "172.18.0.6"]
# ...
[END]
.. index:: Conditions; date
Expand All @@ -669,15 +729,23 @@ date()
# True, if the day of the current month is 7
[date("j") == 7]
# ...
[END]
# True, if the day of the current week is 7
[date("w") == 7]
# ...
[END]
# True, if the day of the current year is 7
[date("z") == 7]
# ...
[END]
# True, if the current hour is 7
[date("G") == 7]
# ...
[END]
.. index:: Conditions; like
Expand All @@ -702,12 +770,18 @@ like()
# Search a string with * within another string
[like("fooBarBaz", "*Bar*")]
# ...
[END]
# Search string with single characters in between, using ?
[like("fooBarBaz", "f?oBa?Baz")]
# ...
[END]
# Search string using regular expression
[like("fooBarBaz", "/f[o]{2,2}[aBrz]+/")]
# ...
[END]
.. index:: Conditions; traverse
Expand Down Expand Up @@ -768,9 +842,13 @@ compatVersion()
# True, if the current TYPO3 version is 12.4.x
[compatVersion("12.4")]
# ...
[END]
# True, if the current TYPO3 version is 12.4.5
[compatVersion("12.4.5")]
# ...
[END]
.. index:: Conditions; getTSFE
Expand Down Expand Up @@ -825,6 +903,8 @@ getenv()
:caption: EXT:site_package/Configuration/TypoScript/setup.typoscript
[getenv("VIRTUAL_HOST") == "www.example.org"]
# ...
[END]
.. index:: Conditions; feature
Expand All @@ -849,6 +929,8 @@ feature()
# True, if the feature toggle for enforcing the Content Security Policy
# in the frontend is enabled
[feature("security.frontend.enforceContentSecurityPolicy") === true]
# ...
[END]
.. index:: Conditions; ip
Expand Down Expand Up @@ -948,6 +1030,8 @@ request.getQueryParams()
# is not defined. This will check if the GET parameter
# tx_news_pi1[news] in the URL is greater than 0:
[request && traverse(request.getQueryParams(), 'tx_news_pi1/news') > 0]
# ...
[END]
.. index:: Conditions; request.getParsedBody()
Expand All @@ -970,6 +1054,8 @@ request.getParsedBody()
:caption: EXT:site_package/Configuration/TypoScript/setup.typoscript
[request && traverse(request.getParsedBody(), 'foo') == 1]
# ...
[END]
.. index:: Conditions; request.getHeaders()
Expand Down Expand Up @@ -1018,6 +1104,8 @@ request.getCookieParams()
:caption: EXT:site_package/Configuration/TypoScript/setup.typoscript
[request && request.getCookieParams()['foo'] == 1]
# ...
[END]
.. index:: Conditions; request.getNormalizedParams()
Expand Down Expand Up @@ -1071,10 +1159,13 @@ request.getPageArguments()
:caption: EXT:site_package/Configuration/TypoScript/setup.typoscript
[request && request.getPageArguments().get('foo_id') > 0]
# ...
[END]
# True, if current page type is 98
[request && request.getPageArguments()?.getPageType() == 98]
# ...
[END]
.. index:: Conditions; session
.. _condition-functions-in-frontend-context-function-session:
Expand All @@ -1099,6 +1190,8 @@ session()
# Match, if the session has the value 1234567 in the structure :php:`$foo['bar']`:
[session("foo|bar") == 1234567]
# ...
[END]
.. index:: Conditions; site
Expand Down Expand Up @@ -1152,18 +1245,28 @@ site()
# Site identifier
[site("identifier") == "my_site"]
# ...
[END]
# Match site base host
[site("base").getHost() == "www.example.org"]
# ...
[END]
# Match base path
[site("base").getPath() == "/"]
# ...
[END]
# Match root page UID
[site("rootPageId") == 1]
# ...
[END]
# Match a configuration property
[traverse(site("configuration"), "myCustomProperty") == true]
# ...
[END]
.. index:: Conditions; siteLanguage
Expand Down

0 comments on commit bbd018e

Please sign in to comment.