Skip to content
Browse files

Merge pull request #47 from gsteel/3.1

Use URL Prefix as defined by the Listing Page class in CMS
  • Loading branch information...
2 parents 743f403 + 51e9b7c commit 50e3c4154d0b7a2d269b9f92afae7e1f4a776ec5 Aram Balakjian committed
Showing with 7 additions and 1 deletion.
  1. +7 −1 code/DataObjects/DataObjectAsPage.php
View
8 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 50e3c41

Please sign in to comment.
Something went wrong with that request. Please try again.