Skip to content

Commit

Permalink
Merge pull request #1230 from ezsystems/location-1-ct-node-name
Browse files Browse the repository at this point in the history
EZP-31367: Do not use translated node name for Location ID 1 in Content Tree
  • Loading branch information
lserwatka authored Feb 11, 2020
2 parents 39feeea + 15e03f0 commit d23c668
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion src/lib/UI/Module/ContentTree/NodeFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ public function createNode(
$depth,
$location->id,
$location->contentId,
$this->translationHelper->getTranslatedContentName($content),
$this->getNodeName($location),
$contentType ? $contentType->identifier : '',
$contentType ? $contentType->isContainer : true,
$location->invisible || $location->hidden,
Expand Down Expand Up @@ -245,4 +245,14 @@ private function countSubitems(Location $parentLocation): int

return $this->searchService->findLocations($searchQuery)->totalCount;
}

private function getNodeName(Location $location): string
{
$content = $location->getContent();

// Location ID 1 (no VersionInfo) needs special handling
return null === $content->getVersionInfo()
? $location->getContentInfo()->name
: $this->translationHelper->getTranslatedContentName($content);
}
}

0 comments on commit d23c668

Please sign in to comment.