starts); parent::ConvertToDateTime($this->ends); $images = ($images != null) ? $images : (isset($data->images) ? $data->images : null); if($images) { $this->images = []; foreach($images as $image) { $this->images[] = new NewsImage($image, '/img/news/'); } } $this->url = "/agenda/{$this->id}/" . parent::url_slug($this->title); } public function excerpt() { $hasImages = count($this->images) > 0; $maxLength = $hasImages ? 200 : 500; return '

' . substr($this->content, 0, $maxLength) . (strlen($this->content) > $maxLength ? '...' : '') . '

'; } }