mirror of
https://github.com/silverstripe/silverstripe-docsviewer
synced 2024-10-22 11:05:56 +02:00
Refactored EditLink
This commit is contained in:
parent
5cbd9c79cd
commit
1e2737bc5a
@ -573,15 +573,20 @@ class DocumentationViewer extends Controller {
|
||||
* @return string
|
||||
*/
|
||||
public function getEditLink() {
|
||||
|
||||
$page = $this->getPage();
|
||||
|
||||
if($page) {
|
||||
|
||||
$entity = $page->getEntity();
|
||||
|
||||
if($entity && isset(self::$edit_links[$entity->title])) {
|
||||
|
||||
|
||||
if($entity && isset(self::$edit_links[strtolower($entity->title)])) {
|
||||
|
||||
// build the edit link, using the version defined
|
||||
$url = self::$edit_links[$entity->title];
|
||||
$version = $this->getVersion();
|
||||
$url = self::$edit_links[strtolower($entity->title)];
|
||||
$version = $entity->getVersion();
|
||||
|
||||
if($version == "trunk" && (isset($url['options']['rewritetrunktomaster']))) {
|
||||
if($url['options']['rewritetrunktomaster']) {
|
||||
@ -592,10 +597,10 @@ class DocumentationViewer extends Controller {
|
||||
return str_replace(
|
||||
array('%entity%', '%lang%', '%version%', '%path%'),
|
||||
array(
|
||||
$entity->getBaseFolder(),
|
||||
$entity->title,
|
||||
$this->getLanguage(),
|
||||
$version,
|
||||
ltrim($page->getPath(), '/')
|
||||
ltrim($page->getRelativePath(), '/')
|
||||
),
|
||||
|
||||
$url['url']
|
||||
|
Loading…
Reference in New Issue
Block a user