mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 12:05:37 +00:00
Merge pull request #3407 from dhensby/pulls/file-link
Removing duplicate code and keeping File API consistent
This commit is contained in:
commit
3ff4bf633e
@ -248,12 +248,31 @@ class File extends DataObject {
|
||||
return $item;
|
||||
}
|
||||
|
||||
/**
|
||||
* Just an alias function to keep a consistent API with SiteTree
|
||||
*
|
||||
* @return string The link to the file
|
||||
*/
|
||||
public function Link() {
|
||||
return Director::baseURL() . $this->RelativeLink();
|
||||
return $this->getURL();
|
||||
}
|
||||
|
||||
/**
|
||||
* Just an alias function to keep a consistent API with SiteTree
|
||||
*
|
||||
* @return string The relative link to the file
|
||||
*/
|
||||
public function RelativeLink() {
|
||||
return $this->Filename;
|
||||
return $this->getFilename();
|
||||
}
|
||||
|
||||
/**
|
||||
* Just an alias function to keep a consistent API with SiteTree
|
||||
*
|
||||
* @return string The absolute link to the file
|
||||
*/
|
||||
public function AbsoluteLink() {
|
||||
return $this->getAbsoluteURL();
|
||||
}
|
||||
|
||||
/**
|
||||
@ -671,7 +690,7 @@ class File extends DataObject {
|
||||
* @return string
|
||||
*/
|
||||
public function getAbsoluteURL() {
|
||||
return Director::absoluteBaseURL() . $this->getFilename();
|
||||
return Director::absoluteURL($this->getURL());
|
||||
}
|
||||
|
||||
/**
|
||||
@ -681,7 +700,7 @@ class File extends DataObject {
|
||||
* @return string
|
||||
*/
|
||||
public function getURL() {
|
||||
return Director::baseURL() . $this->getFilename();
|
||||
return Controller::join_links(Director::baseURL(), $this->getFilename());
|
||||
}
|
||||
|
||||
/**
|
||||
|
Loading…
x
Reference in New Issue
Block a user