/** * @DI\Observe("copy_widget_config_simple_text") * * @param CopyWidgetConfigurationEvent $event */ public function onCopyWidgetConfiguration(CopyWidgetConfigurationEvent $event) { $source = $event->getWidgetInstance(); $copy = $event->getWidgetInstanceCopy(); $widgetConfig = $this->simpleTextManager->getTextConfig($source); if (!is_null($widgetConfig)) { $widgetConfigCopy = new SimpleTextConfig(); $widgetConfigCopy->setWidgetInstance($copy); $widgetConfigCopy->setContent($this->replaceLinks($widgetConfig->getContent(), $event->getResourceInfos())); $this->om->persist($widgetConfigCopy); $this->om->flush(); } $event->validateCopy(); $event->stopPropagation(); }
/** * @DI\Observe("copy_widget_config_core_resource_logger") * * @param CopyWidgetConfigurationEvent $event */ public function onCopyWidgetConfiguration(CopyWidgetConfigurationEvent $event) { $source = $event->getWidgetInstance(); $copy = $event->getWidgetInstanceCopy(); $widgetConfig = $this->logManager->getLogConfig($source); if (!is_null($widgetConfig)) { $widgetConfigCopy = new LogWidgetConfig(); $widgetConfigCopy->setWidgetInstance($copy); $widgetConfigCopy->setAmount($widgetConfig->getAmount()); $widgetConfigCopy->setRestrictions($widgetConfig->getRestrictions()); $this->om->persist($widgetConfigCopy); $this->om->flush(); } $event->validateCopy(); $event->stopPropagation(); }