/** * Add sections * * @param \Softlogo\CMSBundle\Entity\Section $sections * @return Section */ public function addSection(\Softlogo\CMSBundle\Entity\Section $sections) { $sections->setParent($this); $sections->setIsMainSection(false); $this->sections[] = $sections; return $this; }
public function getSection($parameters = array()) { if (isset($parameters['entity'])) { $entityOryg = $parameters['entity']; $this->sectionPager->setSection($entityOryg); $entity = $this->sectionPager->getSectionsPage(1); $entityTitle = $entity->getTitle(); //$entityType=$entity->getSectionType()->__toString(); $entityType = $entity->getType(); $parameters['type'] = !isset($parameters['type']) ? $entityType : $parameters['type']; /* *Robię wyjątak w sytuacji gdy używam artykułów ze strony */ if ($entityTitle == 'Main') { $section = new Section(); $section->addArticleCollection($this->page->getArticles()); $section->setTitle($this->page->getTitle()); $parameters['entity'] = $section; } elseif ($entityTitle == 'Main - First') { $section = new Section(); $section->addArticle($this->page->getFirstArticle()); $section->setTitle($this->page->getTitle()); $parameters['entity'] = $section; } elseif ($entityTitle == 'Main - Last') { $section = new Section(); $section->addArticleCollection($this->page->getLastArticles()); $section->setTitle($this->page->getTitle()); $parameters['entity'] = $section; } } else { $section = new Section(); $section->addArticleCollection($this->page->getArticles()); $section->setTitle($this->page->getTitle()); $parameters['entity'] = $section; //$parameters['type']==''; } return $this->container->get('softlogo.CMSHelper')->section($parameters); }