diff --git a/docs/configuration.md b/docs/configuration.md
index 4524ab6..ecd801e 100644
--- a/docs/configuration.md
+++ b/docs/configuration.md
@@ -202,13 +202,14 @@ a **QGIS project**:
We offer you [here](../tests/lizmap/instances/pgrouting) a basic project which contains
only the layers required and configured for Lizmap.
-If you want create your project or use another existing project to use this module:
+If you want **create your project** or use another existing project to use this module:
-* Add the **Edges** and **Nodes** layers
-* The QGIS project must be called `pgrouting.qgs`
+* Add the **edges** and **nodes** layers with these exact names.
+* The QGIS project must be called `pgrouting.qgs` or contain a QGIS **project variable**
+ called `lizmap_pgrouting_enabled` with the value `yes`
![pgrouting_layers](media/pgrouting_layers.jpg)
-* You must then create a configuration for Lizmap with the **Lizmap plugin**. No specific
+* You must then create a **configuration** for Lizmap with the **Lizmap plugin**. No specific
configuration is needed for the module. You can configure like you want or just click on the
apply button.
diff --git a/pgrouting/classes/pgroutingDockable.listener.php b/pgrouting/classes/pgroutingDockable.listener.php
index f5064a9..cdcde1a 100644
--- a/pgrouting/classes/pgroutingDockable.listener.php
+++ b/pgrouting/classes/pgroutingDockable.listener.php
@@ -30,7 +30,13 @@ public function onmapDockable($event)
}
} else {
// Project name must contain 'pgrouting' to enable the module
- if (strpos($event->project, 'pgrouting') !== false) {
+ // OR the QGIS project variable lizmap_pgrouting_enabled must be yes
+ $p = \lizmap::getProject($repository . '~' . $project);
+ $customVariables = $p->getCustomProjectVariables();
+ if (strpos($project, 'pgrouting') !== false || (
+ array_key_exists('lizmap_pgrouting_enabled', $customVariables)
+ && strtolower(trim($customVariables['lizmap_pgrouting_enabled'])) == 'yes'
+ )) {
$bp = jApp::urlBasePath();
// dock
$content = '';
diff --git a/pgrouting/controllers/default.classic.php b/pgrouting/controllers/default.classic.php
index 984ea42..d880f01 100644
--- a/pgrouting/controllers/default.classic.php
+++ b/pgrouting/controllers/default.classic.php
@@ -147,7 +147,7 @@ public function index()
$p = lizmap::getProject($repository . '~' . $project);
if (!$p) {
- $resp->data = array('status' => 'error', 'message' => 'A problem occured while loading project with Lizmap');
+ $resp->data = array('status' => 'error', 'message' => 'A problem occurred while loading project with Lizmap');
return $resp;
}
diff --git a/tests/lizmap/instances/pgrouting/pgrouting.qgs b/tests/lizmap/instances/pgrouting/pgrouting.qgs
index 5a4ad32..d116de0 100644
--- a/tests/lizmap/instances/pgrouting/pgrouting.qgs
+++ b/tests/lizmap/instances/pgrouting/pgrouting.qgs
@@ -1,4 +1,4 @@
-
+
@@ -44,9 +44,9 @@
-
+
@@ -76,111 +76,6 @@
0
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
+