Skip to content

Commit

Permalink
FIX Fixed minor formatting issue of URL displayed in backend to avoid…
Browse files Browse the repository at this point in the history
… problems with extralong URLs
  • Loading branch information
nyeholt committed May 14, 2014
1 parent 8c97eff commit 657f54f
Showing 1 changed file with 14 additions and 2 deletions.
16 changes: 14 additions & 2 deletions code/extensions/MultisitesSiteTreeExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,20 @@ public function DefaultSite() {
}

public function updateCMSFields(FieldList $fields) {
$prefix = $this->owner->Parent()->AbsoluteLink();
$fields->dataFieldByName('URLSegment')->setURLPrefix($prefix);
if($this->owner->ParentID) {
$url = $this->owner->Parent()->AbsoluteLink();
if(!$url){
$url = $this->owner->Parent()->getURL() . '/';
}
} else {
$url = Director::absoluteBaseURL();
}

if(strlen($url) > 36) {
$url = '...' . substr($url, -32);
}

$fields->dataFieldByName('URLSegment')->setURLPrefix($url);
}

/**
Expand Down

0 comments on commit 657f54f

Please sign in to comment.