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
|
* @return string
|
||||||
*/
|
*/
|
||||||
public function getEditLink() {
|
public function getEditLink() {
|
||||||
|
|
||||||
$page = $this->getPage();
|
$page = $this->getPage();
|
||||||
|
|
||||||
if($page) {
|
if($page) {
|
||||||
|
|
||||||
$entity = $page->getEntity();
|
$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
|
// build the edit link, using the version defined
|
||||||
$url = self::$edit_links[$entity->title];
|
$url = self::$edit_links[strtolower($entity->title)];
|
||||||
$version = $this->getVersion();
|
$version = $entity->getVersion();
|
||||||
|
|
||||||
if($version == "trunk" && (isset($url['options']['rewritetrunktomaster']))) {
|
if($version == "trunk" && (isset($url['options']['rewritetrunktomaster']))) {
|
||||||
if($url['options']['rewritetrunktomaster']) {
|
if($url['options']['rewritetrunktomaster']) {
|
||||||
@ -592,10 +597,10 @@ class DocumentationViewer extends Controller {
|
|||||||
return str_replace(
|
return str_replace(
|
||||||
array('%entity%', '%lang%', '%version%', '%path%'),
|
array('%entity%', '%lang%', '%version%', '%path%'),
|
||||||
array(
|
array(
|
||||||
$entity->getBaseFolder(),
|
$entity->title,
|
||||||
$this->getLanguage(),
|
$this->getLanguage(),
|
||||||
$version,
|
$version,
|
||||||
ltrim($page->getPath(), '/')
|
ltrim($page->getRelativePath(), '/')
|
||||||
),
|
),
|
||||||
|
|
||||||
$url['url']
|
$url['url']
|
||||||
|
Loading…
Reference in New Issue
Block a user