public function setLayout(Layout $layout, AbstractClassContent $toPushInMainZone = null)
    {
        $this->_layout = $layout;

        $count = count((array) $layout->getZones());
        // Add as much ContentSet to the page main ContentSet than defined zones in layout
        for ($i = $this->getContentSet()->count(); $i < $count; $i++) {
            // Do this case really exists ?
            if (null === $zone = $layout->getZone($i)) {
                $this->getContentSet()->push(new ContentSet());
                continue;
            }

            // Create a new column
            $contentset = new ContentSet(null, $zone->options);

            if (null !== $toPushInMainZone && true === $zone->mainZone) {
                // Existing content push in the main zone
                $contentset->push($toPushInMainZone->setMainNode($this));
            } elseif ('inherited' === $zone->defaultClassContent) {
                // Inherited zone => same ContentSet than parent if exist
                $contentset = $this->getInheritedContent($i, $contentset);
            } elseif ($zone->defaultClassContent) {
                // New default content push
                $contentset->push($this->createNewDefaultContent(
                    'BackBee\ClassContent\\'.$zone->defaultClassContent,
                    $zone->mainZone
                ));
            }

            $this->getContentSet()->push($contentset);
        }

        return $this;
    }
public function setLayout(Layout $layout, AbstractClassContent $toPushInMainZone = null)
    {
        $this->_layout = $layout;

        $count = count((array) $layout->getZones());
        // Add as much ContentSet to the page main ContentSet than defined zones in layout
        for ($i = $this->getContentSet()->count(); $i < $count; $i++) {
            // Do this case really exists ?
            if (null === $zone = $layout->getZone($i)) {
                $this->getContentSet()->push(new ContentSet());
                continue;
            }

            // Create a new column
            $contentset = new ContentSet(null, $zone->options);

            if (null !== $toPushInMainZone && true === $zone->mainZone) {
                // Existing content push in the main zone
                $contentset->push($toPushInMainZone->setMainNode($this));
            } elseif ('inherited' === $zone->defaultClassContent) {
                // Inherited zone => same ContentSet than parent if exist
                $contentset = $this->getInheritedContent($i, $contentset);
            } elseif ($zone->defaultClassContent) {
                // New default content push
                $contentset->push($this->createNewDefaultContent(
                    'BackBee\ClassContent\\'.$zone->defaultClassContent,
                    $zone->mainZone
                ));
            }

            $this->getContentSet()->push($contentset);
        }

        return $this;
    }
public function setLayout ( Layout $ layout , AbstractClassContent $ toPushInMainZone = null ) { $ this -> _layout = $ layout ; $ count = count ( ( array ) $ layout -> getZones ( ) ) ; // Add as much ContentSet to the page main ContentSet than defined zones in layout for ( $ i = $ this -> getContentSet ( ) -> count ( ) ; $ i < $ count ; $ i ++ ) { // Do this case really exists ? if ( null === $ zone = $ layout -> getZone ( $ i ) ) { $ this -> getContentSet ( ) -> push ( new ContentSet ( ) ) ; continue ; } // Create a new column $ contentset = new ContentSet ( null , $ zone -> options ) ; if ( null !== $ toPushInMainZone && true === $ zone -> mainZone ) { // Existing content push in the main zone $ contentset -> push ( $ toPushInMainZone -> setMainNode ( $ this ) ) ; } elseif ( 'inherited' === $ zone -> defaultClassContent ) { // Inherited zone => same ContentSet than parent if exist $ contentset = $ this -> getInheritedContent ( $ i , $ contentset ) ; } elseif ( $ zone -> defaultClassContent ) { // New default content push $ contentset -> push ( $ this -> createNewDefaultContent ( 'BackBee\ClassContent\\' . $ zone -> defaultClassContent , $ zone -> mainZone ) ) ; } $ this -> getContentSet ( ) -> push ( $ contentset ) ; } return $ this ; }
Sets the layout for the page.
Adds as much ContentSet to the page main ContentSet than defined zones in layout.

@param  Layout               $layout
@param  AbstractClassContent $toPushInMainZone

@return Page
Sets the layout for the page . Adds as much ContentSet to the page main ContentSet than defined zones in layout .