Skip to content

Commit 2a02aa6

Browse files
authored
Adjust code samples after deprecations removal in v5 (#2461)
* Fixed EveryoneArticleTab example * Fixed CustomLimitationFormMapper code samples
1 parent e916812 commit 2a02aa6

File tree

2 files changed

+9
-9
lines changed

2 files changed

+9
-9
lines changed

code_samples/back_office/dashboard/article_tab/src/Tab/Dashboard/Everyone/EveryoneArticleTab.php

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,33 +2,33 @@
22

33
namespace App\Tab\Dashboard\Everyone;
44

5-
use Ibexa\AdminUi\Tab\Dashboard\PagerContentToDataMapper;
5+
use Ibexa\AdminUi\Tab\Dashboard\PagerLocationToDataMapper;
66
use Ibexa\Contracts\AdminUi\Tab\AbstractTab;
77
use Ibexa\Contracts\AdminUi\Tab\OrderedTabInterface;
88
use Ibexa\Contracts\Core\Repository\SearchService;
99
use Ibexa\Contracts\Core\Repository\Values\Content\LocationQuery;
1010
use Ibexa\Contracts\Core\Repository\Values\Content\Query\Criterion;
1111
use Ibexa\Contracts\Core\Repository\Values\Content\Query\SortClause;
12-
use Ibexa\Core\Pagination\Pagerfanta\ContentSearchAdapter;
12+
use Ibexa\Core\Pagination\Pagerfanta\LocationSearchAdapter;
1313
use Pagerfanta\Pagerfanta;
1414
use Symfony\Contracts\Translation\TranslatorInterface;
1515
use Twig\Environment;
1616

1717
class EveryoneArticleTab extends AbstractTab implements OrderedTabInterface
1818
{
19-
protected PagerContentToDataMapper $pagerContentToDataMapper;
19+
protected PagerLocationToDataMapper $pagerLocationToDataMapper;
2020

2121
protected SearchService $searchService;
2222

2323
public function __construct(
2424
Environment $twig,
2525
TranslatorInterface $translator,
26-
PagerContentToDataMapper $pagerContentToDataMapper,
26+
PagerLocationToDataMapper $pagerLocationToDataMapper,
2727
SearchService $searchService
2828
) {
2929
parent::__construct($twig, $translator);
3030

31-
$this->pagerContentToDataMapper = $pagerContentToDataMapper;
31+
$this->pagerLocationToDataMapper = $pagerLocationToDataMapper;
3232
$this->searchService = $searchService;
3333
}
3434

@@ -60,7 +60,7 @@ public function renderView(array $parameters): string
6060
]);
6161

6262
$pager = new Pagerfanta(
63-
new ContentSearchAdapter(
63+
new LocationSearchAdapter(
6464
$query,
6565
$this->searchService
6666
)
@@ -69,7 +69,7 @@ public function renderView(array $parameters): string
6969
$pager->setCurrentPage($page);
7070

7171
return $this->twig->render('@ibexadesign/ui/dashboard/tab/all_content.html.twig', [
72-
'data' => $this->pagerContentToDataMapper->map($pager),
72+
'data' => $this->pagerLocationToDataMapper->map($pager, true),
7373
]);
7474
}
7575
}

code_samples/back_office/limitation/src/Security/Limitation/Mapper/CustomLimitationFormMapper.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@
55
namespace App\Security\Limitation\Mapper;
66

77
use Ibexa\AdminUi\Limitation\LimitationFormMapperInterface;
8-
use Ibexa\AdminUi\Translation\Extractor\LimitationTranslationExtractor;
98
use Ibexa\Contracts\Core\Repository\Values\User\Limitation;
9+
use Ibexa\Core\Limitation\LimitationIdentifierToLabelConverter;
1010
use Symfony\Component\Form\Extension\Core\Type\CheckboxType;
1111
use Symfony\Component\Form\FormInterface;
1212

@@ -15,7 +15,7 @@ class CustomLimitationFormMapper implements LimitationFormMapperInterface
1515
public function mapLimitationForm(FormInterface $form, Limitation $data): void
1616
{
1717
$form->add('limitationValues', CheckboxType::class, [
18-
'label' => LimitationTranslationExtractor::identifierToLabel($data->getIdentifier()),
18+
'label' => LimitationIdentifierToLabelConverter::convert($data->getIdentifier()),
1919
'required' => false,
2020
'data' => $data->limitationValues['value'],
2121
'property_path' => 'limitationValues[value]',

0 commit comments

Comments
 (0)