Ejemplo n.º 1
0
 /**
  * @param \App\Model\Entities\Article $article
  * @return array Vychozi hodnoty pro formular
  */
 protected function getDefaults($article)
 {
     $result = [];
     $result['id'] = $article->getId();
     $result['title'] = $article->getTitle();
     $result['description'] = $article->getDescription();
     $result['published'] = $article->isPublished();
     $publishDate = $article->getPublishDate();
     if ($publishDate) {
         $result['publishDate'] = $publishDate->format('d. m. Y, H:i');
     }
     $result['content'] = $article->getContent();
     foreach ($article->getTags() as $tag) {
         $result['tags'][] = $tag->getId();
     }
     return $result;
 }
Ejemplo n.º 2
0
 /**
  * Grid column render.
  * @param Article $e
  * @return string
  */
 public function titleRender($e)
 {
     return \Nette\Utils\Html::el("span")->addAttributes(["title" => $e->getTitle()])->setText(\Nette\Utils\Strings::truncate($e->getTitle(), 20));
 }