Skip to content

Commit

Permalink
Fix indistinguishable suggestions for nodes (#433)
Browse files Browse the repository at this point in the history
refs #427
  • Loading branch information
moreamazingnick authored Apr 23, 2024
1 parent 3a0b40a commit e9a551e
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 2 deletions.
2 changes: 1 addition & 1 deletion application/controllers/SuggestionsController.php
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ public function processAction()
) {
yield [
'search' => $search,
'label' => $bpNode->getAlias() ?? $bpNode->getName(),
'label' => $bpNode->getLabel(),
'config' => $config
];
}
Expand Down
2 changes: 1 addition & 1 deletion application/forms/AddNodeForm.php
Original file line number Diff line number Diff line change
Expand Up @@ -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());
}
}
}
Expand Down
11 changes: 11 additions & 0 deletions library/Businessprocess/Node.php
Original file line number Diff line number Diff line change
Expand Up @@ -367,6 +367,17 @@ public function setAlias($alias)
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;
Expand Down

0 comments on commit e9a551e

Please sign in to comment.