src/View/DefaultWidgetBuilder.php
public function handleEvent(BuildWidgetEvent $event)
    {
        // Only run in the frontend or when the widget is not build yet
        if (false === $this->scopeDeterminator->currentScopeIsFrontend() || null !== $event->getWidget()) {
            return;
        }

        $widget = $this->buildWidget($event->getEnvironment(), $event->getProperty(), $event->getModel());

        $event->setWidget($widget);
    }
public function handleEvent(BuildWidgetEvent $event)
    {
        // Only run in the frontend or when the widget is not build yet
        if (false === $this->scopeDeterminator->currentScopeIsFrontend() || null !== $event->getWidget()) {
            return;
        }

        $widget = $this->buildWidget($event->getEnvironment(), $event->getProperty(), $event->getModel());

        $event->setWidget($widget);
    }
Handle the build widget event.

@param BuildWidgetEvent $event The event.

@return void