/**
  * @param Author $author
  * @return Document[]
  */
 public function generateAuthorIndices(Author $author)
 {
     $indexes = array();
     foreach ($this->getLayouts() as $layout) {
         $file = $layout->getBasename();
         preg_match('#authors\\.(.+?)\\.twig$#', $file, $match);
         $format = $match[1];
         $document = new Document();
         $document->setLayout((string) $file);
         $document->setPath(sprintf('authors/%s.%s', $author->getHandle(), $format));
         $document->setTitle(sprintf('Author: %s (%s)', $author->get('name'), $author->getHandle()));
         $document->setVars(array('author' => $author));
         $indexes[] = $document;
     }
     return $indexes;
 }
Exemplo n.º 2
0
 public function testGetUnknownProperty()
 {
     $author = new Author('test');
     $this->assertNull($author->get('invalid-attribute'));
 }