Skip to content
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 10 additions & 5 deletions src/lib/UI/Module/ContentTree/NodeFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -116,14 +116,17 @@
$bookmarkedLocations,
$requestFilter
);

//TODO decide on the limit of version infos to load at once

Check warning on line 120 in src/lib/UI/Module/ContentTree/NodeFactory.php

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Complete the task associated to this "TODO" comment.

See more on https://sonarcloud.io/project/issues?id=ibexa_admin-ui&issues=AZq0_Usdhgmuh_dx3KcD&open=AZq0_Usdhgmuh_dx3KcD&pullRequest=1777
$uninitializedContentInfoList = array_splice($uninitializedContentInfoList, 0, 30);
$versionInfoById = $this->contentService->loadVersionInfoListByContentInfo($uninitializedContentInfoList);

$aggregatedChildrenCount = null;
if ($this->searchService->supports(SearchService::CAPABILITY_AGGREGATIONS)) {
$aggregatedChildrenCount = $this->countAggregatedSubitems($containerLocations, $requestFilter);
}

$this->supplyTranslatedContentName($node, $versionInfoById);
$this->supplyContentName($node, $versionInfoById);
$this->supplyChildrenCount($node, $aggregatedChildrenCount, $requestFilter);

return $node;
Expand Down Expand Up @@ -392,7 +395,7 @@
$location->getId(),
$location->getContentId(),
$contentInfo->currentVersionNo,
'', // node name will be provided later by `supplyTranslatedContentName` method
$contentInfo->getName(),
null !== $contentType ? $contentType->getIdentifier() : '',
null === $contentType || $contentType->isContainer(),
$location->isInvisible(),
Expand Down Expand Up @@ -420,14 +423,16 @@
/**
* @param \Ibexa\Contracts\Core\Repository\Values\Content\VersionInfo[] $versionInfoById
*/
private function supplyTranslatedContentName(Node $node, array $versionInfoById): void
private function supplyContentName(Node $node, array $versionInfoById): void
{
if ($node->contentId !== self::TOP_NODE_CONTENT_ID) {
$node->name = $this->translationHelper->getTranslatedContentNameByVersionInfo($versionInfoById[$node->contentId]);
if (isset($versionInfoById[$node->contentId])) {

Check warning on line 429 in src/lib/UI/Module/ContentTree/NodeFactory.php

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Merge this if statement with the enclosing one.

See more on https://sonarcloud.io/project/issues?id=ibexa_admin-ui&issues=AZq0_Usdhgmuh_dx3KcE&open=AZq0_Usdhgmuh_dx3KcE&pullRequest=1777
$node->name = $this->translationHelper->getTranslatedContentNameByVersionInfo($versionInfoById[$node->contentId]);
}
}

foreach ($node->children as $child) {
$this->supplyTranslatedContentName($child, $versionInfoById);
$this->supplyContentName($child, $versionInfoById);
}
}

Expand Down
Loading