public function testGetContent() { $item = new Item(Item::TYPE_PAGE, '/foo'); $item->setContent('foo'); $this->assertEquals('foo', $item->getContent()); }
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; }