Search code examples
pluginstypo3typoscripttypo3-11.x

How to add one plugin to multiple pages at once in typo3 and tell which action to use


I have a typo3 installation with one extension that has a plugin.

I want to add the plugin to one page via typoscript and all subpages in that page tree should have it as well. I only find code fragments that use switchableControllerActions but this is deprecated, as far as I can see.

How can I tell the plugin in the page which action is the action to use?


Solution

  • These fragments handling switchableControllerActions can be ignored if you have already separated plugins in your extension.

    lib.insertPlugin = USER
    lib.insertPlugin {
      userFunc = TYPO3\CMS\Extbase\Core\Bootstrap->run
      vendorName = myVendor
      pluginName = MyPlugin
      extensionName = MyExtension
    
      settings =< plugin.tx_myExtension.settings
      persistence =< plugin.tx_myExtension.persistence
      view =< plugin.tx_myExtension.view
    
      settings {
        // ...
      }
    }
    

    The plugin will use its default action (except, there is another action defined in the request, e.g. by submitting a form, following a link,...).

    The first action in the action list of the first line of the configuration parameter is the default action of the plugin. (-> \TYPO3\CMS\Extbase\Utility\ExtensionUtility::configurePlugin())