src/Sulu/Component/Webspace/Loader/XmlFileLoader10.php
protected function generateDefaultTemplates(Webspace $webspace)
    {
        $expected = ['page', 'home'];

        foreach ($this->xpath->query('/x:webspace/x:theme/x:default-templates/x:default-template') as $node) {
            /* @var \DOMNode $node */
            $template = $node->nodeValue;
            $type = $node->attributes->getNamedItem('type')->nodeValue;

            $webspace->addDefaultTemplate($type, $template);
            if ('homepage' === $type) {
                $webspace->addDefaultTemplate('home', $template);
            }
        }

        $found = array_keys($webspace->getDefaultTemplates());
        foreach ($expected as $item) {
            if (!in_array($item, $found)) {
                throw new ExpectedDefaultTemplatesNotFound($this->webspace->getKey(), $expected, $found);
            }
        }

        return $webspace;
    }
protected function generateDefaultTemplates(Webspace $webspace)
    {
        $expected = ['page', 'home'];

        foreach ($this->xpath->query('/x:webspace/x:theme/x:default-templates/x:default-template') as $node) {
            /* @var \DOMNode $node */
            $template = $node->nodeValue;
            $type = $node->attributes->getNamedItem('type')->nodeValue;

            $webspace->addDefaultTemplate($type, $template);
            if ('homepage' === $type) {
                $webspace->addDefaultTemplate('home', $template);
            }
        }

        $found = array_keys($webspace->getDefaultTemplates());
        foreach ($expected as $item) {
            if (!in_array($item, $found)) {
                throw new ExpectedDefaultTemplatesNotFound($this->webspace->getKey(), $expected, $found);
            }
        }

        return $webspace;
    }
protected function generateDefaultTemplates ( Webspace $ webspace ) { $ expected = [ 'page' , 'home' ] ; foreach ( $ this -> xpath -> query ( '/x:webspace/x:theme/x:default-templates/x:default-template' ) as $ node ) { /* @var \DOMNode $node */ $ template = $ node -> nodeValue ; $ type = $ node -> attributes -> getNamedItem ( 'type' ) -> nodeValue ; $ webspace -> addDefaultTemplate ( $ type , $ template ) ; if ( 'homepage' === $ type ) { $ webspace -> addDefaultTemplate ( 'home' , $ template ) ; } } $ found = array_keys ( $ webspace -> getDefaultTemplates ( ) ) ; foreach ( $ expected as $ item ) { if ( ! in_array ( $ item , $ found ) ) { throw new ExpectedDefaultTemplatesNotFound ( $ this -> webspace -> getKey ( ) , $ expected , $ found ) ; } } return $ webspace ; }
Generates the default templates for the webspace.

@param Webspace $webspace

@return Webspace

@throws ExpectedDefaultTemplatesNotFound
Generates the default templates for the webspace .