From 76471a6db1ce009184968eabe36b9822646da017 Mon Sep 17 00:00:00 2001 From: "r.ratsun" Date: Mon, 13 Nov 2017 16:51:25 +0200 Subject: [PATCH] Route: possibility to replace routes in modules --- application/Espo/Core/Utils/Route.php | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/application/Espo/Core/Utils/Route.php b/application/Espo/Core/Utils/Route.php index 1c3eeac512..87071210f1 100644 --- a/application/Espo/Core/Utils/Route.php +++ b/application/Espo/Core/Utils/Route.php @@ -112,17 +112,27 @@ class Route } } + /** + * Unify routes + * + * @return array + */ protected function unify() { - $data = array(); - - $data = $this->getAddData($data, $this->paths['customPath']); + // for custom + $data = $this->getAddData([], $this->paths['customPath']); + // for module + $moduleData = []; foreach ($this->getMetadata()->getModuleList() as $moduleName) { $modulePath = str_replace('{*}', $moduleName, $this->paths['modulePath']); - $data = $this->getAddData($data, $modulePath); + foreach ($this->getAddData([], $modulePath) as $row) { + $moduleData[$row['method'].$row['route']] = $row; + } } + $data = array_merge($data, array_values($moduleData)); + // for core $data = $this->getAddData($data, $this->paths['corePath']); return $data;