Skip to content
Browse files

Use URL Prefix as defined by the Listing Page class when editing a re…

…cord in the CMS
  • Loading branch information...
1 parent 6500206 commit 528b2673b12608e78067625cf07ec4221f99cbc2 @gsteel gsteel committed Feb 8, 2014
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();
+ } 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 528b267

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