Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

URL Segment prefix in CMS now accurate #51

Merged
merged 3 commits into from

2 participants

@arambalakjian

No description provided.

@arambalakjian arambalakjian merged commit 60dd223 into from
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Feb 8, 2014
  1. @gsteel
  2. @gsteel
Commits on Mar 3, 2014
  1. Merge pull request #47 from gsteel/3.1

    Aram Balakjian authored
    Use URL Prefix as defined by the Listing Page class in CMS
This page is out of date. Refresh to see the latest.
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);
Something went wrong with that request. Please try again.