/** * Returns the theme registry or null if not found. * * @param Site|null $site * @return Registry|null */ protected function getThemeRegistry(Site $site = null) { $registry = null; $criteria = ['type' => 'selected_theme', 'scope' => 'THEME_CONFIG']; if (null !== $site) { $criteria['key'] = $site->getLabel(); $registry = $this->app->getEntityManager()->getRepository(Registry::class)->findOneBy($criteria); } if (null === $registry) { $criteria['key'] = 'default'; $registry = $this->app->getEntityManager()->getRepository(Registry::class)->findOneBy($criteria); } return $registry; }
/** * Create new home layout * * @param \BackBee\Site\Site $site Site object * * @return \BackBee\Site\Layout */ private function createHomeLayout($site) { $layout = new \BackBee\Site\Layout(md5('defaultlayout-' . $site->getLabel())); $layout->setData('{"templateLayouts":[{"title":"Top column","layoutSize":{"height":300,"width":false},"gridSizeInfos":{"colWidth":60,"gutterWidth":20},"id":"Layout__1332943638139_1","layoutClass":"bb4ResizableLayout","animateResize":false,"showTitle":false,"target":"#bb5-mainLayoutRow","resizable":true,"useGridSize":true,"gridSize":5,"gridStep":100,"gridClassPrefix":"span","selectedClass":"bb5-layout-selected","position":"none","height":800,"defaultContainer":"#bb5-mainLayoutRow","layoutManager":[],"mainZone":true,"accept":[],"maxentry":"0","defaultClassContent":null},{"title":"Main column","layoutSize":{"height":800,"width":false},"gridSizeInfos":{"colWidth":60,"gutterWidth":20},"id":"Layout__1383430750637_1","layoutClass":"bb5-resizableLayout","animateResize":false,"showTitle":false,"target":"#bb5-mainLayoutRow","resizable":true,"useGridSize":true,"gridSize":2,"gridStep":100,"gridClassPrefix":"span","selectedClass":"bb5-layout-selected","alphaClass":"alpha","omegaClass":"omega","typeClass":"hChild","clearAfter":1,"height":800,"defaultContainer":"#bb5-mainLayoutRow","layoutManager":[],"mainZone":false,"accept":[],"maxentry":0,"defaultClassContent":null},{"title": "Nouvelle zone","layoutSize": {"height": 800,"width": false},"gridSizeInfos": {"colWidth": 60,"gutterWidth": 20},"id": "Layout__1383430750640_1","layoutClass": "bb5-resizableLayout","animateResize": false,"showTitle": false,"target": "#bb5-mainLayoutRow","resizable": true,"useGridSize": true,"gridSize": 2,"gridStep": 100,"gridClassPrefix": "span","selectedClass": "bb5-layout-selected","alphaClass": "alpha","omegaClass": "omega","typeClass": "hChild","clearAfter": 1,"height": 800,"defaultContainer": "#bb5-mainLayoutRow","layoutManager": [],"mainZone": false,"accept": [],"maxentry": 0,"defaultClassContent": null}]}')->setLabel('Home')->setPath('Home.twig')->setPicPath($layout->getUid() . '.png')->setSite($site); $this->entyMgr->persist($layout); return $layout; }
/** * @Serializer\VirtualProperty * @Serializer\SerializedName("site_label") */ public function getSiteLabel() { return null !== $this->_site ? $this->_site->getLabel() : null; }