Skip to content

Commit

Permalink
IBX-7046: Fixed Dashboard "My Content" & "My Media" edit buttons (#2114)
Browse files Browse the repository at this point in the history
* Fixed Dashboard My Content & My Media edit buttons

* Used lazy-loaded VersionInfo data in PagerLocationToDataMapper
  • Loading branch information
alongosz authored Jan 25, 2024
1 parent f8d3028 commit b0db6f5
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 6 deletions.
7 changes: 5 additions & 2 deletions src/lib/Tab/Dashboard/MyContentTab.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,10 @@ public function getOrder(): int
}

/**
* @inheritdoc
* @throws \Twig\Error\Error
* @throws \eZ\Publish\API\Repository\Exceptions\ForbiddenException
* @throws \eZ\Publish\API\Repository\Exceptions\NotFoundException
* @throws \eZ\Publish\API\Repository\Exceptions\UnauthorizedException
*/
public function renderView(array $parameters): string
{
Expand All @@ -50,7 +53,7 @@ public function renderView(array $parameters): string
$pager->setCurrentPage($page);

return $this->twig->render('@ezdesign/ui/dashboard/tab/my_content.html.twig', [
'data' => $this->pagerLocationToDataMapper->map($pager),
'data' => $this->pagerLocationToDataMapper->map($pager, true),
]);
}
}
7 changes: 5 additions & 2 deletions src/lib/Tab/Dashboard/MyMediaTab.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,10 @@ public function getOrder(): int
}

/**
* @inheritdoc
* @throws \Twig\Error\Error
* @throws \eZ\Publish\API\Repository\Exceptions\ForbiddenException
* @throws \eZ\Publish\API\Repository\Exceptions\NotFoundException
* @throws \eZ\Publish\API\Repository\Exceptions\UnauthorizedException
*/
public function renderView(array $parameters): string
{
Expand All @@ -50,7 +53,7 @@ public function renderView(array $parameters): string
$pager->setCurrentPage($page);

return $this->twig->render('@ezdesign/ui/dashboard/tab/my_media.html.twig', [
'data' => $this->pagerLocationToDataMapper->map($pager),
'data' => $this->pagerLocationToDataMapper->map($pager, true),
]);
}
}
4 changes: 2 additions & 2 deletions src/lib/Tab/Dashboard/PagerLocationToDataMapper.php
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,8 @@ public function map(Pagerfanta $pager, bool $doMapVersionInfoData = false): arra

/** @var \eZ\Publish\API\Repository\Values\Content\Location $location */
foreach ($pager as $location) {
$contentInfo = $location->contentInfo;
$versionInfo = $doMapVersionInfoData ? $this->contentService->loadVersionInfo($contentInfo) : null;
$contentInfo = $location->getContentInfo();
$versionInfo = $doMapVersionInfoData ? $location->getContent()->getVersionInfo() : null;
$contentType = $location->getContentInfo()->getContentType();

$data[] = [
Expand Down

0 comments on commit b0db6f5

Please # to comment.