public function onGadgetExportConf(ExportDataPackageEvent $event) { $pages = array(); $em = $this->container->get('doctrine')->getManager(); $currentConfig = $event->getConfig(); $menuId = $currentConfig['gadgetParam']['menu-id']; $menu = $em->getRepository('KeosuDataModelMenuModelBundle:MenuEntry')->find($menuId); $parts = $menu->getParts(); $tmp = array(); // add icon to page id foreach ($parts as $part) { $tmp['id'] = $part->getTarget(); if ($part->getPath() != null) { $this->copyIcon($part->getPath(), $this->getUploadAbsolutePath()); } if ($part->getPathActive() != null) { $this->copyIcon($part->getPathActive(), $this->getUploadAbsolutePath()); } $tmp['icon'] = $part->getPath(); $tmp['iconActive'] = $part->getPathActive(); $tmp['name'] = $part->getName(); $tmp['css'] = $part->getCss(); $pages[] = $tmp; } $event->setData(json_encode($pages)); }