Skip to content
This repository has been archived by the owner on Jan 10, 2021. It is now read-only.

Commit

Permalink
Correcting an issue that was preventing new media page creation.
Browse files Browse the repository at this point in the history
  • Loading branch information
Nathan Glasl committed Aug 24, 2016
1 parent 7a5c027 commit 17e6ad2
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions code/pages/MediaPage.php
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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.

Expand Down

0 comments on commit 17e6ad2

Please sign in to comment.