Deprecation-89463-SwitchableControllerActions.rst 3.3 KB
Newer Older
1
2
.. include:: ../../Includes.txt

3
4
5
=====================================================
Deprecation: #89463 - `Switchable Controller Actions`
=====================================================
6
7
8
9
10
11
12
13
14

See :issue:`89463`

Description
===========

`Switchable controller actions` have been marked as deprecated and will be removed in one of the next major versions
of TYPO3, probably version 11.0 or 12.0.

15
:ts:`Switchable controller actions` are used to override the allowed set of controllers and actions via TypoScript or plugin
16
17
18
19
flexforms. While this is convenient for reusing the same plugin for a lot of different use cases, it's also very
problematic as it completely overrides the original configuration defined via
:php:`\TYPO3\CMS\Extbase\Utility\ExtensionUtility::configurePlugin`.

20
:ts:`Switchable controller actions` therefore have bad implications that rectify their removal.
21

22
First of all, :ts:`switchable controller actions` override the original configuration of plugins at runtime and possibly
23
24
25
26
depending on conditions which contradicts the idea of :php:`\TYPO3\CMS\Extbase\Utility\ExtensionUtility::configurePlugin`
being the authoritative way to define configuration.

Using the same plugin as an entry point for many different functionalities contradicts the idea of a plugin serving one
27
specific purpose. :ts:`Switchable controller actions` allow for creating one central plugin that takes care of everything.
28
29
30
31
32


Impact
======

33
34
All plugins that are using :ts:`switchable controller actions` need to be split into multiple different plugins. Usually, one
would create a new plugin for each possible :ts:`switchable controller actions` configuration entry.
35
36
37
38
39


Affected Installations
======================

40
41
All installations that make use of :ts:`switchable controller actions`, either via flexform configuration of plugins or via
TypoScript configuration.
42
43
44
45
46


Migration
=========

47
Unfortunately, an automatic migration is not possible. As :ts:`switchable controller actions` allowed to override the whole
48
configuration of allowed controllers and actions, the only way to migrate is to create dedicated plugins for each former
49
:ts:`switchable controller actions` configuration entry.
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75

Example:

.. code-block:: xml

   <switchableControllerActions>
      <TCEforms>
         <label>switchable controller actions</label>
         <config>
            <renderType>selectSingle</renderType>
            <items>
               <numIndex index="1">
                  <numIndex index="0">List</numIndex>
                  <numIndex index="1">Product->list</numIndex>
               </numIndex>
               <numIndex index="2">
                  <numIndex index="0">Show</numIndex>
                  <numIndex index="1">Product->show</numIndex>
               </numIndex>
            </items>
         </config>
      </TCEforms>
   </switchableControllerActions>

This configuration would lead to the creation configuration of two different plugins like this:

76
.. code-block:: php
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94

    \TYPO3\CMS\Extbase\Utility\ExtensionUtility::configurePlugin(
        'extension',
        'list',
        [
            'Product' => 'list'
        ]
    );

    \TYPO3\CMS\Extbase\Utility\ExtensionUtility::configurePlugin(
        'extension',
        'show',
        [
            'Product' => 'show'
        ]
    );

.. index:: FlexForm, PHP-API, TypoScript, NotScanned, ext:extbase