Version 12 of TYPO3 included some big features which are mentioned most of the time. In this talk we take a look at some of the smaller features which may be very useful for your projects.
2. Little Gems in TYPO3 v12
Features and changes that didn’t make the headlines
@jigalvh
Jigal van Hemert
jigal.van.hemert@typo3.org
3. Who is this guy?
▪︎ TYPO3 developer at MaxServ
▪︎ Working with TYPO3 since v3.8 (?)
▪︎ Translations of core labels in Dutch
▪︎ Shares home with wife and ten dogs
6. New stdwrap.if options
If now supports contains, startsWith and endsWith
10 = TEXT
10 {
value = The contact page
if {
value.data = page:title
startsWith = Contact
}
}
7. New cObject EXTBASEPLUGIN
With the new object there is no need to define the userfunc and a USER object
10 = EXTBASEPLUGIN
10 {
extensionName = myextension
pluginName = myplugin
}
This provides better structure to configuration and allows to change Extbase
bootstrap in the future.
8. Copy page access settings from parent
If there are custom owner/group settings and access patterns for parts of the
pagetree and these need to be set to new subpages there is a new value
copyFromParent.
TCEMAIN.permissions.userid = copyFromParent
TCEMAIN.permissions.groupid = copyFromParent
TCEMAIN.permissions.user = copyFromParent
TCEMAIN.permissions.group = copyFromParent
TCEMAIN.permissions.everybody = copyFromParent
9. Additional attributes for TS Include*
All the page.include* properties now support custom additional attributes.
page = PAGE
page {
includeCSSLibs {
myIncludeFile = someFile.css
myIncludeFile.data-foo = plaap
}
}
10. TypoScript option to render all links absolute
If all links, images, assets need absolute URLs (e.g. emails other static pages) a
new option forces this.
config.forceAbsoluteUrls = 1
15. Site con
fi
guration (yaml) in backend
In the module Configuration it’s now
possible to see the resulting
configuration of Sites, including
routing configuration, languages, and
so on.
23. Symfony Poly
fi
ll packages
▪︎ Also in older versions of TYPO3
▪︎ Code can use functions from newer PHP versions (not language constructs)
▪︎ Example: PHP 8.3 function json_validate() can already be used
24. Settings.php can be read-only *)
If Settings.php is read-only the Install Tool displays the edit fields as disabled.
A
ft
er deploying the file can be read-only to prevent any changes by admins via
the Install Tool.
*) Patch pending to fix a bug in this feature
25. Automatic database
fi
eld for slugs
Fields with TCA type ‘slug’ are also automatically created in the database (if
they are not defined in the ext_tables.sql file).
26. Database column type ‘json’ support (1)
▪︎ insert(), update(), bulkInsert()
▪︎ value can be array, will be automatically converted
ext_tables.sql:
CREATE TABLE tx_myextension_domain_model_foo (
col1 varchar(100) DEFAULT '',
col2 json
);
27. Database column type ‘json’ support (2)
TCA type ‘json’ allows editing (using T3Editor if that is available)
28. Simple query parameters for Extbase BE modules
Query parameters without namespaces can be used in BE modules based on
Extbase.
To disable this for an extension:
module.tx_myextension {
features {
enableNamespacedArgumentsForBackend = 1
}
}
30. DataProcessors tagged with short name for TS
DataProcessors can be tagged and the tag can be used as name in TS. This also
enables DI. In Services.yaml:
VendorMyExtensionDataProcessingFooProcessor:
tags:
- { name: ‘data.processor’, identifier:
‘powerfoo’ }
In TypoScript:
dataProcessing.10 = powerfoo
31. Easier tagging of backend controllers
Previously in Services.yaml:
VendorMyExtControllerSomeBackendController:
tags: [‘backend.controler’]
Alternative:
use TYPO3CMSBackendAttributeController;
#[Controller]
class SomeBackendController {}
32. Easier registration of upgrade wizard
Register upgrade wizard throught PHP custom attribute.
use TYPO3CMSInstallAttributeUpgradeWizard;
#[UpgradeWizard('fooUpgradeWizard')]
class FooUpgradeWizard implements
UpgradeWizardInterface {}
34. API to read site settings (1)
In older versions:
$redirectSettings = $site
->getConfiguration()[‘settings']['redirects'] ?? [];
35. API to read site settings (2)
Now:
$siteSettings = $site->getSettings();
$redirectSettings = $siteSettings->get(‘redirects’);
TypoScript:
page.10 = TEXT
page.10.data = siteSettings:redirects.httpStatusCode
36. Language fallback for content (1)
The fallback type ‘fallback’ now works for content too.
▪︎ Works in TypoScript and Extbase
▪︎ Only with fallbackType = fallback
▪︎ Stops at default language (with weird fallback chains)
Fallback types ☞
37. Language fallback for content (2)
strict:
Only renders content that is translated in the target language or created in that
language. Keeps sorting behaviour from default language.
free:
Only looks at content in target language, ignores sorting behaviour from
default language.
38. Language fallback for content (3)
fallback:
If page is not available (or not even created) in target language it follows the
fallback chain.
For each content part it’s checked if it’s available in the target language,
otherwise fallback chain is checked.
41. Magic methods in Extbase repositories are deprecated!!
Methods like findBy<Property>(), findOneBy<Property>(),
countBy<Property>() are marked as deprecated. In v13 deprecation
notices will be triggered and they will be removed in v14.
New:
findBy([‘propertyName’ => $propertyValue]);
findOneBy([‘propertyName’ => $propertyValue]);
count([‘propertyName’ => $propertyValue]);