Deprecation: #96524 - Deprecate inline JavaScript in Dashboard
See forge#96524
Description
Using inline JavaScript when initializing RequireJS modules in individual dashboard widgets has been deprecated. Widget implementations have to be adjusted accordingly.
Impact
Usages will trigger PHP E_
errors.
Affected Installations
Installations having individual widget implementations which are
- implementing
\TYPO3\
CMS\ Dashboard\ Widgets\ Require Js Module Interface - invoking
\TYPO3\
CMS\ Dashboard\ Dashboard Initialization Service->get Require Js Modules
Migration
Affected widget have to implement \TYPO3\
instead of deprecated \TYPO3\
.
Instead of using inline JavaScript for initializing RequireJS modules,
\TYPO3\
have to be declared.
class ExampleChartWidget implements RequireJsModuleInterface
{
// ...
public function getJavaScriptModuleInstructions(): array
{
return [
'TYPO3/CMS/Dashboard/ChartInitializer' =>
'function(ChartInitializer) { ChartInitializer.initialize(); }',
];
}
}
Deprecated example widget above would look like the following when using
Java
and Java
:
class ExampleChartWidget implements JavaScriptInterface
{
// ...
public function getJavaScriptModuleInstructions(): array
{
return [
JavaScriptModuleInstruction::forRequireJS(
'TYPO3/CMS/Dashboard/ChartInitializer'
)->invoke('initialize'),
];
}
}