public function testGetAttributes() { $attributes = ['title' => 'Hi Spress']; $item = new Item(Item::TYPE_PAGE, '/attributes'); $item->setAttributes($attributes); $this->assertEquals($attributes, $item->getAttributes()); }
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; }