Search code examples
typo3typoscriptextbasetypo3-7.6.xtypo3-extensions

How to make child pages inherit a parent bundle


I would like to know how I could make child pages (more than 10k) inherit a parent page plugin.

The old way to make a plugin, was to create a pi1/class.tx_extkey_pi1.php file that extends \TYPO3\CMS\Frontend\Plugin\AbstractPlugin and that it was easy to set in parent page and automatically the children pages.

Now, with an Extbase MVC plugin, I've got controllers than extend ActionController but I can't make it recursive.

Does somebody know a way to do it?

Big thank you for any help


Solution

  • AbstractPlugin

    Classes that inherit from AbstractPlugin (so called Pi-Based-Plugins) where invoked in TypoScript like this:

    page = PAGE
    page.10 = USER
    page.10 {
      userFunc = tx_myext_pi1->main
    }
    

    Extbase

    Using the Extbase MVC dispatcher, plugins are called like the following - this will call the first registered action of the first registered controller in ext_localconf.php:

    page = PAGE
    page.10 = USER
    page.10 {
        userFunc = TYPO3\CMS\Extbase\Core\Bootstrap->run
        vendorName = MyVendor
        extensionName = MyExtension
        pluginName = MyPlugin
    }
    

    However, there's a work-around to select a specific action in TypoScript using switchableControllerActions - the follow TypoScript invokes MyVendor\MyExtension\MyController::myAction():

    page = PAGE
    page.10 = USER
    page.10 {
        userFunc = TYPO3\CMS\Extbase\Core\Bootstrap->run
        vendorName = MyVendor
        extensionName = MyExtension
        pluginName = MyPlugin
        switchableControllerActions {
            My {       // automatically expanded to class name "MyController"
                0 = my // automatically expanded to method name "myAction"
            }
        }
    }