Pārlūkot izejas kodu

Add _p.web_url variable in twig template BT#13169

jmontoyaa 7 gadi atpakaļ
vecāks
revīzija
b092665a78
2 mainītis faili ar 13 papildinājumiem un 0 dzēšanām
  1. 12 0
      main/inc/lib/api.lib.php
  2. 1 0
      main/inc/lib/template.lib.php

+ 12 - 0
main/inc/lib/api.lib.php

@@ -8186,3 +8186,15 @@ function location($url, $exit = true)
         exit;
     }
 }
+
+/**
+ * @return string
+ */
+function api_get_web_url()
+{
+    if (api_get_setting('server_type') == 'test') {
+        return api_get_path(WEB_PATH).'web/app_dev.php/';
+    } else {
+        return api_get_path(WEB_PATH).'web/';
+    }
+}

+ 1 - 0
main/inc/lib/template.lib.php

@@ -530,6 +530,7 @@ class Template
     {
         return [
             'web' => api_get_path(WEB_PATH),
+            'web_url' => api_get_web_url(),
             'web_relative' => api_get_path(REL_PATH),
             'web_course' => api_get_path(WEB_COURSE_PATH),
             'web_main' => api_get_path(WEB_CODE_PATH),