Deprecation: #96903 - Deprecate old ModuleTemplate API

See forge#96903

Description

With the introduction of the simplified ModuleTemplate API a series of PHP methods in backend related ModuleTemplate class became obsolete.

These methods are now marked as deprecated in TYPO3 v12 and will be removed in TYPO3 v13 to encourage backend modules switching to the new API which is easier to use and allows overriding backend templates.

The following methods should not be used anymore:

  • ModuleTemplate->setContent() and ModuleTemplate->renderContent(): These methods were the heart of the old API, using a StandaloneView for module template rendering. They are obsolete using ModuleTemplate->render() or ModuleTemplate->renderResponse() where the outer ModuleTemplate HTML is referenced in "main body" templates as layout.

  • ModuleTemplate->getView(): This was an additional helper for ModuleTemplate->setContent() and ModuleTemplate->renderContent() and is deprecated together with these.

  • ModuleTemplate->getBodyTag() and ModuleTemplate->isUiBlock(): ModuleTemplate should be a data sink. It should not be abused to carry data around that is later retrieved again. Controllers that need these methods should be refactored slightly to carry the information around themselves.

  • ModuleTemplate->registerModuleMenu(): This was a helper method for "third level" menu registration of (especially) the info module. It is unused in Core since at least TYPO3 v7. Extensions most likely don't use it.

  • ModuleTemplate->getDynamicTabMenu(): This is a helper to render a "tabbed" view of item titles and item content. Using the methods leads to strange controller code that relies on multiple Fluid view instances at the same time. Consuming controllers should instead add the needed HTML to their templates directly. Example HTML can be found in the EXT:styleguide backend module, section "Tabs".

  • ModuleTemplate->header(): This is a tiny helper method to render a <h1>. It was used to make the page title editable in a couple of controllers in the past. Extensions should put this HTML directly into their templates.

Impact

Methods setContent(), header() and getView() are rather common names, the extension scanner is not configured to scan for them. All other methods names are scanned, the extension scanner will report possible usages as weak match.

All methods will trigger a PHP E_USER_DEPRECATED error when called. One exception is setContent(), which is always used in combination with renderContent() to be useful, so only one deprecation log entry is created when using both methods.

Affected Installations

In general, instances with extensions that add custom backend modules may be affected.

Migration

See the description section and simplified ModuleTemplate API for migration information.