From 17e6ad25c30dbbcb4dfa820d7f18fa727e3ed611 Mon Sep 17 00:00:00 2001 From: Nathan Glasl Date: Wed, 24 Aug 2016 14:09:10 +1000 Subject: [PATCH] Correcting an issue that was preventing new media page creation. --- code/pages/MediaPage.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/code/pages/MediaPage.php b/code/pages/MediaPage.php index 92114c3..9ad2f79 100644 --- a/code/pages/MediaPage.php +++ b/code/pages/MediaPage.php @@ -178,7 +178,7 @@ public function getCMSFields() { $fields->insertAfter('Date', $custom = DateField::create( "{$attribute->ID}_MediaAttribute", $attribute->Title, - date('d/m/Y', strtotime($attribute->Content)) + $attribute->Content ? date('d/m/Y', strtotime($attribute->Content)) : null )->setConfig('showcalendar', true)->setConfig('dateformat', 'dd/MM/YYYY')); } else { @@ -236,7 +236,7 @@ public function validate() { // The URL segment will conflict with a year/month/day/media format when numeric. - if(is_numeric($this->URLSegment) || !($parent instanceof MediaHolder) || ($parent->MediaTypeID != $this->MediaTypeID)) { + if(is_numeric($this->URLSegment) || !($parent instanceof MediaHolder) || ($this->MediaTypeID && ($parent->MediaTypeID != $this->MediaTypeID))) { // Customise a validation error message.