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

Commit

Permalink
[FIX] Links are now formed correctly (#22).
Browse files Browse the repository at this point in the history
Co-authored-by: nyeholt <[email protected]>
  • Loading branch information
Nathan Glasl and nyeholt committed Mar 12, 2019
1 parent 87b9656 commit 0537ad9
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# [mediawesome](https://packagist.org/packages/nglasl/silverstripe-mediawesome)

_The current release is **4.0.4**_
_The current release is **4.0.5**_

> This module allows creation of dynamic media holders/pages with CMS customisable types and attributes (blogs, events, news, publications), including versioning.
Expand Down
9 changes: 7 additions & 2 deletions src/pages/MediaPage.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

use SilverStripe\Assets\File;
use SilverStripe\Assets\Image;
use SilverStripe\Control\Controller;
use SilverStripe\Control\HTTPResponse_Exception;
use SilverStripe\Core\Injector\Injector;
use SilverStripe\Forms\DateField;
Expand Down Expand Up @@ -408,10 +409,14 @@ public function Link($action = null) {
return null;
}
$date = ($parent->URLFormatting !== '-') ? $this->dbObject('Date')->Format($parent->URLFormatting ?: 'y/MM/dd/') : '';
$link = $parent->Link() . "{$date}{$this->URLSegment}/";
$join = array(
$parent->Link(),
"{$date}{$this->URLSegment}/"
);
if($action) {
$link .= "{$action}/";
$join[] = "{$action}/";
}
$link = Controller::join_links($join);
return $link;
}

Expand Down

0 comments on commit 0537ad9

Please sign in to comment.