Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Deprecation: #96903 - Deprecate old ModuleTemplate API #2937

Open
sabbelasichon opened this issue May 6, 2022 · 0 comments
Open

Deprecation: #96903 - Deprecate old ModuleTemplate API #2937

sabbelasichon opened this issue May 6, 2022 · 0 comments

Comments

@sabbelasichon
Copy link
Owner

Deprecation: #96903 - Deprecate old ModuleTemplate API

https://docs.typo3.org/c/typo3/cms-core/master/en-us/Changelog/12.0/Deprecation-96903-DeprecateOldModuleTemplateAPI.html
.. include:: /Includes.rst.txt

======================================================
Deprecation: #96903 - Deprecate old ModuleTemplate API

See :issue:96903

Description

With introduction of the :doc:simplified ModuleTemplate API <Feature-96730-SimplifiedExtbackendModuleTemplateAPI>
a series of PHP methods in backend related :php:ModuleTemplate class became obsolete.

These methods are now marked as deprecated in TYPO3 v12 and will be removed in v13 to
encourage backend modules switching to the new API which is easier to use and
allows :doc:overriding backend templates <Feature-96812-OverrideBackendTemplatesWithTSconfig>.

The following methods should not be used anymore:

  • :php:ModuleTemplate->setContent() and :php:ModuleTemplate->renderContent(): These methods
    were the heart of the old API, using a :php:StandaloneView for module template rendering. They
    are obsolete using :php:ModuleTemplate->render() or :php:ModuleTemplate->renderResponse() where
    the outer ModuleTemplate HTML is referenced in "main body" templates as layout.
  • :php:ModuleTemplate->getView(): This was an additional helper for :php:ModuleTemplate->setContent()
    and :php:ModuleTemplate->renderContent() and is deprecated together with these.
  • :php:ModuleTemplate->getBodyTag() and :php: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.
  • :php: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.
  • :php: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".
  • :php:ModuleTemplate->header(): This is a tiny helper method to render a :html:<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 :php:setContent(), :php:header() and :php: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 raise a deprecation level log entry when called. One exception is :php:setContent(),
which is always used in combination with :php: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 :doc:simplified ModuleTemplate API <Feature-96730-SimplifiedExtbackendModuleTemplateAPI>
for migration information.

.. index:: Backend, PHP-API, PartiallyScanned, ext:backend

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants