diff --git a/application/controllers/SuggestionsController.php b/application/controllers/SuggestionsController.php index 9fa0331..b98755b 100644 --- a/application/controllers/SuggestionsController.php +++ b/application/controllers/SuggestionsController.php @@ -101,7 +101,7 @@ class SuggestionsController extends Controller ) { yield [ 'search' => $search, - 'label' => $bpNode->getAlias() ?? $bpNode->getName(), + 'label' => $bpNode->getLabel(), 'config' => $config ]; } diff --git a/application/forms/AddNodeForm.php b/application/forms/AddNodeForm.php index 3840d8a..fda6c8e 100644 --- a/application/forms/AddNodeForm.php +++ b/application/forms/AddNodeForm.php @@ -236,7 +236,7 @@ class AddNodeForm extends CompatForm 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/Node.php b/library/Businessprocess/Node.php index a0c07d2..30bfcb5 100644 --- a/library/Businessprocess/Node.php +++ b/library/Businessprocess/Node.php @@ -367,6 +367,17 @@ abstract class Node return $this; } + /** + * Get the label of the node + * + * @return ?string + */ + public function getLabel() + { + return ($this->alias ?? $this->name) + . ' (' . implode(' ยป ', $this->getPaths()[0]) . ')'; + } + public function hasParents() { return count($this->parents) > 0;