Nieuws filter op regio

This commit is contained in:
2017-09-05 19:44:10 +02:00
parent eb2710a302
commit a63080acc8
4 changed files with 37 additions and 5 deletions

View File

@@ -59,6 +59,12 @@ class NewsItem extends Model {
$this->keywords = explode(' ', $data->keywords);
}
if(is_object($data->region)) {
$this->region = new \Model\NewsRegion($data->region->title, $data->region->slug);
} else {
$this->region = new \Model\NewsRegion($data->region, $data->region_slug);
}
$images = ($images != null) ? $images
: (isset($data->images) ? $data->images : null);
if($images) {

View File

@@ -2,6 +2,16 @@
namespace Model;
class NewsRegion {
public $title;
public $slug;
public function __construct($title, $slug = null) {
$this->title = $title;
$this->slug = $slug ? $slug : strtolower(str_replace(' ', '', $title));
}
}
class NewsSource {
public $title;
public $url;