Skip to content

Instantly share code, notes, and snippets.

@localhorst
Created February 11, 2021 11:19
Show Gist options
  • Save localhorst/f2015cbe7f66c715b29587c88a8ef27e to your computer and use it in GitHub Desktop.
Save localhorst/f2015cbe7f66c715b29587c88a8ef27e to your computer and use it in GitHub Desktop.
<?php
namespace Myself\MySitepackage\Hooks;
use TYPO3\CMS\Form\Domain\Model\Renderable\RootRenderableInterface;
use TYPO3\CMS\Form\Domain\Runtime\FormRuntime;
/**
* @author Martin Terber <martin.terber@ppw.de>
*/
class FormHooks
{
/**
* @param \TYPO3\CMS\Form\Domain\Runtime\FormRuntime $formRuntime
* @param \TYPO3\CMS\Form\Domain\Model\Renderable\RootRenderableInterface $renderable
* @return void
*/
public function beforeRendering(FormRuntime $formRuntime, RootRenderableInterface $renderable)
{
if ($renderable instanceof \TYPO3\CMS\Form\Domain\Model\FormDefinition) {
if (count($renderable->getPages()) > 1 ) {
$pages = $renderable->getPages();
$renderable->setRenderingOption("navigation", $pages);
}
}
}
}
@localhorst
Copy link
Author

localhorst commented Mar 19, 2021

In your ext_localconf.php:

$GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['ext/form']['beforeRendering'][1613033383] 
    = \Myself\MySitepackage\Hooks\FormHooks::class;

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