Beispiel #1
0
 /**
  * Get post author.
  *
  * @return \Tev\Author\Model\Author
  */
 public function getAuthor()
 {
     if ($this->author === null) {
         $this->author = $this->authorFactory->create($this->getAuthorId());
     }
     return $this->author;
 }
Beispiel #2
0
 /**
  * Get a single author object or array of author objects.
  *
  * If no authors are configured, returned will result will be an empty array
  * if this is a mutli-select, or null if not.
  *
  * @return \Tev\Author\Model\Author|\Tev\Author\Model\Author[]|null
  */
 public function getValue()
 {
     $val = $this->base['value'];
     if (is_array($val)) {
         if (isset($val['ID'])) {
             return $this->authorFactory->create($val['ID']);
         } else {
             $authors = array();
             foreach ($val as $a) {
                 $authors[] = $this->authorFactory->create($a['ID']);
             }
             return $authors;
         }
     } else {
         if (isset($this->base['multiple']) && $this->base['multiple']) {
             return array();
         } else {
             return null;
         }
     }
 }