Skip to content
This repository has been archived by the owner on Sep 26, 2024. It is now read-only.

Update extending pages (EventSubscriberInterface) #172

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

dennisameling
Copy link
Member

@dennisameling dennisameling commented Oct 22, 2020

This is partly work for #159, but it doesn't close the issue yet (there are more examples where the removed CommonSubscriber is used).

This PR fixes one of the cases where CommonSubscriber should be removed.

Inspiration for this was partly taken from https://github.com/mautic/mautic/blob/staging/app/bundles/FormBundle/EventListener/PageSubscriber.php

@dennisameling
Copy link
Member Author

@escopecz would you mind checking this? I find it a bit tricky to come up with a good example here, since some major refactoring was done in Mautic 3.x. I had to dive into some of Mautic's internals to come up with this example.

@@ -36,8 +68,9 @@ class PageSubscriber extends CommonSubscriber
public function onPageBuild(PageBuilderEvent $event)
{
// Add page tokens
$content = $this->templating->render('HelloWorldBundle:SubscribedEvents\PageToken:token.html.php');
$event->addTokenSection('helloworld.token', 'plugin.helloworld.header', $content);
Copy link
Member Author

@dennisameling dennisameling Oct 22, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This function was deleted in Mautic 3.0.0, without any hint as to what should be used instead. $event->addToken() seems to do the job in my testing.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants