Beispiel #1
0
 public function testGetTitle()
 {
     $item = new Item(Item::TYPE_PAGE, '/welcome');
     $item->setTitle('Hi Spress');
     $this->assertEquals('Hi Spress', $item->getTitle());
 }
 protected function getSpressContent(Item $item)
 {
     $attributes = $item->getAttributes();
     switch ($item->getType()) {
         case Item::TYPE_POST:
             if (empty($this->layoutPost) == false) {
                 $attributes['layout'] = $this->layoutPost;
             }
             break;
         case Item::TYPE_PAGE:
             if (empty($this->layoutPage) == false) {
                 $attributes['layout'] = $this->layoutPage;
             }
             break;
     }
     if (empty($item->getTitle()) == false) {
         $attributes['title'] = $item->getTitle();
     }
     $yamlContent = Yaml::dump($attributes);
     $content = sprintf("---\n%s\n---\n%s", $yamlContent, $item->getContent());
     return $content;
 }