From dfa4208c3044de937b0feac2bc67dbc1134d3456 Mon Sep 17 00:00:00 2001 From: Raul Gonzalez Date: Tue, 29 Jan 2019 13:44:05 +0100 Subject: [PATCH] Missing field fixes Fixes for missing content situations. --- app/app.php | 2 +- app/views/bloghome.php | 6 +++--- app/views/slices/image.php | 2 +- composer.lock | 2 +- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/app/app.php b/app/app.php index 8882ca4..4d447da 100755 --- a/app/app.php +++ b/app/app.php @@ -31,7 +31,7 @@ ); // If there is no bloghome content, display 404 page - if ( $bloghomeContent == null ) { + if (!$bloghomeContent || $bloghomeContent->data == new stdClass()) { not_found($app); return; } diff --git a/app/views/bloghome.php b/app/views/bloghome.php index 01fdc69..9447f41 100755 --- a/app/views/bloghome.php +++ b/app/views/bloghome.php @@ -10,7 +10,7 @@ $title = RichText::asText($bloghome->data->headline); $isBloghome = true; -$imageUrl = $bloghome->data->image->url; +$imageUrl = !$bloghome->data->image ? $bloghome->data->image->url : ''; $linkResolver = $prismic->linkResolver; ?> @@ -29,13 +29,13 @@
id ?>>

- data->title, $linkResolver) ?> + data->title ? RichText::asHtml($post->data->title, $linkResolver) : '

Untitled

' ?>

diff --git a/app/views/slices/image.php b/app/views/slices/image.php index b0519e0..e12bbb6 100755 --- a/app/views/slices/image.php +++ b/app/views/slices/image.php @@ -3,7 +3,7 @@ $imageWithCaption = $slice->primary; -$imageUrl = $imageWithCaption->image->url; +$imageUrl = !$imageWithCaption->image ? $imageWithCaption->image->url : ''; $caption = $imageWithCaption->caption; switch ( $slice->slice_label ) { diff --git a/composer.lock b/composer.lock index e404b80..0b7ece0 100755 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "1aa68b447e8b9787efcb4e681f31259a", + "content-hash": "5e2f475f930bcbc7690568a507488561", "packages": [ { "name": "container-interop/container-interop",