From e7df347b14f3b279ecac900293a486925f154ba1 Mon Sep 17 00:00:00 2001 From: MoreAmazingNick Date: Fri, 26 Jan 2024 15:46:41 +0100 Subject: [PATCH] fix/indistinguishable-suggestions-introduce-lable-427 --- application/controllers/SuggestionsController.php | 3 +-- application/forms/AddNodeForm.php | 2 +- library/Businessprocess/BpNode.php | 6 ++++++ 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/application/controllers/SuggestionsController.php b/application/controllers/SuggestionsController.php index da967652..b98755bf 100644 --- a/application/controllers/SuggestionsController.php +++ b/application/controllers/SuggestionsController.php @@ -101,8 +101,7 @@ public function processAction() ) { yield [ 'search' => $search, - 'label' => ($bpNode->getAlias() ?? $bpNode->getName()) - . " (" . implode("->", $bpNode->getPaths()[0]) . ")", + 'label' => $bpNode->getLabel(), 'config' => $config ]; } diff --git a/application/forms/AddNodeForm.php b/application/forms/AddNodeForm.php index 3840d8a1..fda6c8e7 100644 --- a/application/forms/AddNodeForm.php +++ b/application/forms/AddNodeForm.php @@ -236,7 +236,7 @@ protected function assembleExistingProcessElements(): void if (! $bp->hasNode($nodeName)) { $term->setMessage($this->translate('No node with this name found in config')); } else { - $term->setLabel($bp->getNode($nodeName)->getAlias()); + $term->setLabel($bp->getNode($nodeName)->getLabel()); } } } diff --git a/library/Businessprocess/BpNode.php b/library/Businessprocess/BpNode.php index ab76e3e7..bf15a115 100644 --- a/library/Businessprocess/BpNode.php +++ b/library/Businessprocess/BpNode.php @@ -370,6 +370,12 @@ public function getAlias() return $this->alias ? preg_replace('~_~', ' ', $this->alias) : $this->name; } + public function getLabel() + { + return ($this->alias ?? $this->name) + . ' (' . implode(' ยป ', $this->getPaths()[0]) . ')'; + } + /** * @return int */