/**
  * @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);
         $content = $this->replaceResourceLinks($widgetConfig->getContent(), $event->getResourceInfos());
         $widgetConfigCopy->setContent($this->replaceTabsLinks($content, $event->getTabsInfos()));
         $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();
 }