Sulu\Component\Webspace\Webspace::addTemplate PHP Méthode

addTemplate() public méthode

Add a new template for given type.
public addTemplate ( string $type, string $template )
$type string
$template string
    public function addTemplate($type, $template)
    {
        $this->templates[$type] = $template;
    }

Usage Example

Exemple #1
0
 /**
  * Adds the template for the given types as described in the XML document.
  *
  * The types can be arbitrary, so that another bundle can easily add a new type and use the information from the
  * webspace.
  *
  * @param Webspace $webspace
  *
  * @return Webspace
  */
 protected function generateTemplates(Webspace $webspace)
 {
     foreach ($this->xpath->query('/x:webspace/x:templates/x:template') as $templateNode) {
         /* @var \DOMNode $templateNode */
         $template = $templateNode->nodeValue;
         $type = $templateNode->attributes->getNamedItem('type')->nodeValue;
         $webspace->addTemplate($type, $template);
     }
     return $webspace;
 }
All Usage Examples Of Sulu\Component\Webspace\Webspace::addTemplate