diff --git a/app/Http/Controllers/NewsController.php b/app/Http/Controllers/NewsController.php
index 247d5720..fab80ecc 100644
--- a/app/Http/Controllers/NewsController.php
+++ b/app/Http/Controllers/NewsController.php
@@ -22,22 +22,24 @@ class NewsController extends Controller
switch ($apiResult->version) {
case 1:
- if (!$newsItem->content) return redirect('//nhnieuws.nl/gooi');
- return view('newsitem', ['news' => $newsItem, 'metadata' => $newsItem->metadata]);
- break;
+ if (!$newsItem->content) return redirect('//nhnieuws.nl/gooi');
- case 2:
+ case 2:
+ if(isset($apiResult->source->article)) {
$source = $apiResult->source->article;
$newsItem->published = self::TimestampToDateTime($source->created);
$newsItem->edited = self::TimestampToDateTime($source->updated);
$newsItem->author = $source->author;
$newsItem->images = null; // Images will be embedded
$newsItem->video = null; // Videos will be embedded
- $newsItem->content = $source->blocks;
+ $newsItem->content = $source->blocks;
+ } elseif(isset($apiResult->source->blocks)) {
+ $newsItem->content = $apiResult->source->blocks;
+ }
+
-
- return view('newsitem', array_merge($this->getSidebareData(), ['news' => $newsItem, 'metadata' => $newsItem->metadata, 'searchURL' => 'nieuws/zoeken']));
+ return view('newsitem', array_merge($this->getSidebareData(), ['type' => $apiResult->type, 'news' => $newsItem, 'metadata' => $newsItem->metadata, 'searchURL' => 'nieuws/zoeken']));
}
}
diff --git a/resources/views/newsitem.blade.php b/resources/views/newsitem.blade.php
index 6b2b81a2..5302ca44 100644
--- a/resources/views/newsitem.blade.php
+++ b/resources/views/newsitem.blade.php
@@ -87,8 +87,10 @@
@endif
@endif
- @if(is_array($news->content))
- @include('partial/nh_story', ['content' => $news->content])
+ @if($type == "nhnieuws")
+ @include('partial/nh_story', ['content' => $news->content])
+ @elseif($type == "artikel")
+ @include('partial/block_story', ['content' => $news->content])
@else
{!!$news->content!!}
diff --git a/resources/views/partial/block_story.blade.php b/resources/views/partial/block_story.blade.php
new file mode 100644
index 00000000..b79c6aa0
--- /dev/null
+++ b/resources/views/partial/block_story.blade.php
@@ -0,0 +1,161 @@
+@foreach($content as $block)
+@if($block->type == "headerRichA")
+@php($block->data->image->url = isset($block->data->image->crops)
+? $block->data->image->crops->{'16:9'}->{'1600'}
+: $block->data->image->crop)
+
+
+
+
+ {{$block->data->image->title}}
+ @if($block->data->image->author)
+ {{$block->data->image->author}}
+ @endif
+
+@elseif($block->type == "paragraph")
+
{!!$block->data->text!!}
+@elseif($block->type == "intro")
+
{!!strip_tags($block->data->text)!!}
+@elseif($block->type == "info")
+@if(strpos($block->data->text, "Meer nieuws uit 't Gooi?") === false)
+
{!!($block->data->text)!!}
+@endif
+@elseif($block->type == "quote")
+
+ {!!$block->data->text!!}
+ {{$block->data->caption}}
+
+@elseif($block->type == "image")
+data->image->imageWide))
+ $image = $block->data->image->imageWide;
+ else if(isset($block->data->image->crop))
+ $image = $block->data->image->crop;
+ else if(isset($block->data->image->crops) && isset($block->data->image->crops->{'16:9'}))
+ foreach($block->data->image->crops->{'16:9'} as $image) break;
+ else if(isset($block->data->image->imageHigh))
+ $image = $block->data->image->imageHigh;
+ else $image = null;
+ ?>
+@if($image)
+
+
+
+
+ data->image->caption) && $block->data->image->caption) {
+ $sentence[] = '' . $block->data->image->caption . '';
+ } elseif (isset($block->data->image->title) && $block->data->image->title) {
+ $sentence[] = '' . $block->data->image->title . '';
+ }
+ if (isset($block->data->image->author) && $block->data->image->author) {
+ $sentence[] = '' . $block->data->image->author . '';
+ }
+ $sentence = join('|', $sentence);
+ ?>
+ {!!$sentence!!}
+
+@endif
+@elseif($block->type == "video" || $block->type == "headerVideo")
+@include('widgets/mediaplayer')
+data->video->images[0]->imageMedia) && $block->data->video->images[0]->imageMedia) {
+ $attr = ' poster="' . $block->data->video->images[0]->imageMedia . '"';
+ }
+ ?>
+
+
+ {{$block->data->video->author}}
+
+@elseif($block->type == "carousel")
+
+@elseif($block->type == "oembed")
+
{!!$block->data->html!!}
+@elseif($block->type == "podcast" && $block->data->id == $news->podcast?->id)
+@include('widgets/podcastplayer', ['podcast' => $news->podcast])
+ $news->podcast = null; // Avoid adding the player again ?>
+@elseif($block->type == 'article' && count($block->data->articles) && $block->data->articles[0]->published)
+
+
+
+
+ @foreach($block->data->articles as $article)
+ if(!isset($article->published)) continue;
+ $article->published = new \DateTime($article->published); ?>
+ -
+
+ @if($article->image)
+
+ @endif
+
+
+
+
+ {{Formatter::relativeDate($article->published)}} om {{$article->published->format('H:i')}}
+
+
+
+
+ @endforeach
+
+
+
+@elseif($block->type == 'iframe')
+
+
+@endif
+@endforeach