Permalink
Browse files

Merge pull request #51 from arambalakjian/3.1

URL Segment prefix in CMS now accurate
  • Loading branch information...
Aram Balakjian
Aram Balakjian committed Mar 3, 2014
2 parents b87b233 + 50e3c41 commit 60dd22363a0b7e96eb4381a806d99b30467336b2
Showing with 7 additions and 1 deletion.
  1. +7 −1 code/DataObjects/DataObjectAsPage.php
@@ -211,7 +211,13 @@ public function getCMSFields()
if($this->ID)
{
$urlsegment = new SiteTreeURLSegmentField("URLSegment", $this->fieldLabel('URLSegment'));
- $urlsegment->setURLPrefix(Director::absoluteBaseURL() . 'listing-page/show/');
+
+ if($this->getListingPage()) {
+ $prefix = $this->getListingPage()->AbsoluteLink('show').'/';
+ } else {
+ $prefix = Director::absoluteBaseURL() . 'listing-page/show/';
+ }
+ $urlsegment->setURLPrefix($prefix);
$helpText = _t('SiteTreeURLSegmentField.HelpChars', ' Special characters are automatically converted or removed.');
$urlsegment->setHelpText($helpText);

0 comments on commit 60dd223

Please sign in to comment.