@@ -131,10 +131,20 @@ function render(&$tree, $level, &$s)
131131 return "<div class='report-tree'> " . $ s . "</div> " ;
132132 }
133133
134+ public static function getAdminBaseRelative ()
135+ {
136+ $ config = \Grav \Common \Grav::instance ()['config ' ];
137+ $ route = $ config ->get ('plugins.admin.route ' );
138+ $ base = '/ ' . trim ($ route , '/ ' );
139+ return $ config ->grav ['base_url_relative ' ] . $ base ;
140+ // $admin_base = '/' . trim($config->get('plugins.admin.route'), '/');
141+ // $admin_base = trim($config->get('plugins.admin.route'), '/');
142+ // return $admin_base;
143+ }
144+
134145 public static function edit_link ($ page , $ text )
135146 {
136- $ base = \Grav \Common \Grav::instance ()['base_url_relative ' ];
137- $ href = $ base . "/admin/pages " . $ page ->route ();
147+ $ href = self ::getAdminBaseRelative () . "/pages " . $ page ->route ();
138148 return "<a href=' $ href'> " . $ text . "</a> " ;
139149 }
140150
@@ -155,7 +165,7 @@ public static function view_url($page)
155165 public static function edit_url ($ page )
156166 {
157167 $ base = \Grav \Common \Grav::instance ()['base_url_relative ' ];
158- $ href = $ base . "/admin /pages " . $ page ->route ();
168+ $ href = self :: getAdminBaseRelative () . "/pages " . $ page ->route ();
159169 return $ href ;
160170 }
161171
@@ -211,7 +221,7 @@ public static function getUnusedMedia()
211221 $ unused [$ path ] = $ html ;
212222// $unused[$path] = [
213223// "page" => ,
214- // "preview" =>
224+ // "preview" =>
215225// ];
216226 }
217227 }
@@ -306,4 +316,4 @@ public static function isCachedPath($page)
306316 {
307317 return preg_match (self ::rxCached, $ page );
308318 }
309- }
319+ }
0 commit comments