developer-documentation icon indicating copy to clipboard operation
developer-documentation copied to clipboard

M3 - Config event subscriber needs an update in dev docs

Open dennisameling opened this issue 5 years ago • 0 comments

This page in the docs explains how plugins can hook into Mautic's configuration section in the UI. The function onConfigGenerate() is key here. In Mautic 3, the way this is done has been changed, so we need to update the docs. All details about how it should be in M3 can be found in UPGRADE-3.0.md.

In short, for Mautic 2.x it was:

public function onConfigGenerate(ConfigBuilderEvent $event)
{
    $event->addForm([
        'bundle'     => 'EmailBundle',
        'formAlias'  => 'emailconfig',
        'formTheme'  => 'MauticEmailBundle:FormTheme\Config',
        'parameters' => $event->getParametersFromConfig('MauticEmailBundle'),
    ]);
}

... now it should be something like (note formType was added):

public function onConfigGenerate(ConfigBuilderEvent $event)
{
    $event->addForm([
        'bundle'     => 'EmailBundle',
        'formType'   => ConfigType::class,
        'formAlias'  => 'emailconfig',
        'formTheme'  => 'MauticEmailBundle:FormTheme\Config',
        'parameters' => $event->getParametersFromConfig('MauticEmailBundle'),
    ]);
}

Want to back this issue? Post a bounty on it! We accept bounties via Bountysource.

dennisameling avatar Jul 09 '20 15:07 dennisameling