Skip to content
Open
Show file tree
Hide file tree
Changes from 16 commits
Commits
Show all changes
45 commits
Select commit Hold shift + click to select a range
c843d14
NGSTACK-906 add 'priority' property to Tag objects
AntePrkacin Jun 18, 2025
1c5b716
NGSTACK-906 add support for 'priority' property in the Mapper layer
AntePrkacin Jun 18, 2025
2d27fc0
NGSTACK-906 modify createTagFindQuery method to select 'priority' pro…
AntePrkacin Jun 18, 2025
a8cf605
NGSTACK-906 add 'priority' column to 'eztags' table in MySQL and Post…
AntePrkacin Jun 18, 2025
3a84111
NGSTACK-906 add translations for tag priority
AntePrkacin Jun 18, 2025
8e535ea
NGSTACK-906 show 'priority' column for tag's children
AntePrkacin Jun 18, 2025
7d59685
NGSTACK-906 add 'subitems' tab to the show tag template
AntePrkacin Jun 18, 2025
fe7ba81
NGSTACK-906 add 'subitems' tab template with dropdowns for sortBy and…
AntePrkacin Jun 18, 2025
9158a5d
NGSTACK-906 add translations for tag subitems sorting
AntePrkacin Jun 18, 2025
9ce9427
NGSTACK-906 update tag children sorting functionality in TagControlle…
AntePrkacin Jun 20, 2025
60cf2cf
NGSTACK-906 add support for sorting in loadTagChildren() method in Se…
AntePrkacin Jun 20, 2025
1041265
NGSTACK-906 add support for sorting in loadChildren() method for Tag …
AntePrkacin Jun 20, 2025
0955f35
NGSTACK-906 add support for sorting in getChildren() method for Gatew…
AntePrkacin Jun 20, 2025
43def26
NGSTACK-906 update subitems sort option value from 'tag_id' to 'id' i…
AntePrkacin Jun 20, 2025
f0aa890
NGSTACK-906 remove 'subitems' tag tab and add the tag sorting at the …
AntePrkacin Jun 20, 2025
f1e4e1a
NGSTACK-906 update tests to handle 'priority' property
AntePrkacin Jun 20, 2025
6139978
NGSTACK-906 add enums for tag sortField and sortOrder properties
AntePrkacin Jun 24, 2025
df8003b
NGSTACK-906 add sortField and sortOrder properties to Tag objects and…
AntePrkacin Jun 24, 2025
ef0d60a
NGSTACK-906 update Mappers with sortField and sortOrder fields
AntePrkacin Jun 24, 2025
be00504
NGSTACK-906 remove sortBy and sortOrder parameters from the getChildr…
AntePrkacin Jun 24, 2025
d88c066
NGSTACK-906 remove sortBy and sortOrder parameters from the loadChild…
AntePrkacin Jun 24, 2025
c0bf0f4
NGSTACK-906 remove sortBy and sortOrder parameters from the loadTagCh…
AntePrkacin Jun 24, 2025
c719cc4
NGSTACK-906 rename subitems template to sort_children_tags template a…
AntePrkacin Jun 24, 2025
93c1134
NGSTACK-906 add sortField and sortOrder properties to UpdateStruct an…
AntePrkacin Jun 24, 2025
41e6787
NGSTACK-906 remove sorting logic in ChildrenTagsAdapter
AntePrkacin Jun 24, 2025
705fc35
NGSTACK-906 add new route and controller method for updating sortFiel…
AntePrkacin Jun 24, 2025
2397fcc
NGSTACK-906 rename sortField property to sortBy property everywhere
AntePrkacin Jun 24, 2025
c6c4555
NGSTACK-906 add logic for sorting children by sortBy and sortOrder in…
AntePrkacin Jun 24, 2025
4a5391d
NGSTACK-906 fix tests regarding sortBy and sortOrder properties
AntePrkacin Jun 24, 2025
4224d33
NGSTACK-906 update TagSortBy and TagSortOrder enums, iterate through …
AntePrkacin Jun 24, 2025
e16f73f
NGSTACK-906 throw BadRequestHttpException if sortBy or sortOrder para…
AntePrkacin Jun 24, 2025
dba4689
NGSTACK-906 change sort_by and sort_order column types from enums to …
AntePrkacin Jun 25, 2025
a6100ae
NGSTACK-906 add config params for sorting all child tags and for sort…
AntePrkacin Jun 25, 2025
5733962
NGSTACK-906 update Mapper and DoctrineDatabase Gateway with logic for…
AntePrkacin Jun 25, 2025
5479257
NGSTACK-906 add support for 'sort' config params in tests
AntePrkacin Jun 25, 2025
148a3c3
NGSTACK-906 add ability to modify 'priority' property when editing a …
AntePrkacin Jun 25, 2025
3704566
NGSTACK-906 fix the update() method in DoctrineDatabase and the test …
AntePrkacin Jun 25, 2025
59beb45
NGSTACK-906 update 'sortBy' and 'sortOrder' properties to be null on …
AntePrkacin Jun 25, 2025
84d9758
NGSTACK-906 update getChildren() and update() methods in DoctrineData…
AntePrkacin Jun 25, 2025
fd507dd
NGSTACK-906 update Mapper to properly handle the case when sortBy or …
AntePrkacin Jun 25, 2025
a81d3f6
NGSTACK-906 update sort_children_tags template to check if sortBy or …
AntePrkacin Jun 25, 2025
0ce8c25
NGSTACK-906 add MySQL and PostgreSQL upgrade scripts for 'priority', …
AntePrkacin Jun 26, 2025
3e9628a
NGSTACK-906 don't show 'priority' info on synonyms and remove 'priori…
AntePrkacin Jun 26, 2025
c6d1f47
NGSTACK-906 add 'priority', 'sort_by' and 'sort_order' fields to lega…
AntePrkacin Jun 26, 2025
031c1aa
NGSTACK-906 add policy for sorting children tags
AntePrkacin Jun 26, 2025
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
4 changes: 3 additions & 1 deletion bundle/API/Repository/TagsService.php
Original file line number Diff line number Diff line change
Expand Up @@ -71,12 +71,14 @@ public function loadTagByUrl(string $url, array $languages): Tag;
* @param int $limit The number of tags returned. If $limit = -1 all children starting at $offset are returned
* @param string[]|null $languages A language filter for keywords. If not given all languages are returned
* @param bool $useAlwaysAvailable Add main language to $languages if true (default) and if tag is always available
* @param string|null $sortBy The field to sort the children by (e.g. 'id', 'keyword', 'modificationDate', 'priority')
* @param string|null $sortOrder The sort direction, either 'asc' or 'desc'
*
* @throws \Ibexa\Contracts\Core\Repository\Exceptions\UnauthorizedException If the current user is not allowed to read tags
*
* @return \Netgen\TagsBundle\API\Repository\Values\Tags\TagList
*/
public function loadTagChildren(?Tag $tag = null, int $offset = 0, int $limit = -1, ?array $languages = null, bool $useAlwaysAvailable = true): TagList;
public function loadTagChildren(?Tag $tag = null, int $offset = 0, int $limit = -1, ?array $languages = null, bool $useAlwaysAvailable = true, ?string $sortBy = null, ?string $sortOrder = null): TagList;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we need this level of control, in contrast to just using whatever info is storred on parent tag?

Copy link
Author

@AntePrkacin AntePrkacin Jun 24, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this level of control is necessary because in the Gateway layer (getChildren() method), the fetched data from the database needs to first be sorted and then sliced using $limit and $offset values.

Which info stored on parent tag do you mean? Perhaps another approach for sorting would be if each Tag object would have information attached to it about the sortBy and sortOrder, something like the Location object in Ibexa has (if I'm not mistaken).

EDIT: read the comment below this one. OK, I will implement the sorting mechanism similar to the Ibexa one


/**
* Returns the number of children of a tag object.
Expand Down
8 changes: 8 additions & 0 deletions bundle/API/Repository/Values/Tags/Tag.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
* @property-read bool $alwaysAvailable Indicates if the Tag object is shown in the main language if it is not present in an other requested language
* @property-read string $mainLanguageCode The main language code of the Tag object
* @property-read string[] $languageCodes List of languages in this Tag object
* @property-read int $priority Tag priority
*/
final class Tag extends ValueObject
{
Expand Down Expand Up @@ -104,6 +105,13 @@ final class Tag extends ValueObject
*/
protected ?string $prioritizedLanguageCode;

/**
* Tag priority.
*
* Position of the Tag among its siblings when sorted by priority.
*/
protected int $priority;

/**
* Construct object optionally with a set of properties.
*
Expand Down
10 changes: 8 additions & 2 deletions bundle/Controller/Admin/TagController.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
use Ibexa\Contracts\Core\Repository\Exceptions\NotFoundException;
use Netgen\TagsBundle\API\Repository\TagsService;
use Netgen\TagsBundle\API\Repository\Values\Tags\Tag;
use Netgen\TagsBundle\Core\Pagination\Pagerfanta\ChildrenTagsAdapter;
use Netgen\TagsBundle\Core\Pagination\Pagerfanta\SearchTagsAdapter;
use Netgen\TagsBundle\Form\Type\CopyTagsType;
use Netgen\TagsBundle\Form\Type\LanguageSelectType;
Expand All @@ -16,7 +17,6 @@
use Netgen\TagsBundle\Form\Type\TagCreateType;
use Netgen\TagsBundle\Form\Type\TagMergeType;
use Netgen\TagsBundle\Form\Type\TagUpdateType;
use Pagerfanta\Adapter\AdapterInterface;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;

Expand All @@ -29,7 +29,7 @@ final class TagController extends Controller
public function __construct(
private TagsService $tagsService,
private ContentTypeService $contentTypeService,
private AdapterInterface $tagChildrenAdapter,
private ChildrenTagsAdapter $tagChildrenAdapter,
private SearchTagsAdapter $searchTagsAdapter,
) {}

Expand All @@ -45,6 +45,12 @@ public function showTagAction(Request $request, ?Tag $tag = null): Response
if (!$tag instanceof Tag || !$tag->isSynonym()) {
$configResolver = $this->getConfigResolver();

$sortBy = $request->query->get('sort_by');
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was under the impression that the sorting mechanism will be stored on parent tag, similar to how Ibexa does it in their locations. That way, you don't need to set the sorting for every children fetch, it will automatically fetch tags with the defined sort.

Default sort can then be set in configuration.

$sortOrder = $request->query->get('sort_order');
if ($sortBy !== null && $sortOrder !== null) {
$this->tagChildrenAdapter->setSorting($sortBy, $sortOrder);
}

$currentPage = (int) $request->query->get('page');
$pager = $this->createPager(
$this->tagChildrenAdapter,
Expand Down
4 changes: 2 additions & 2 deletions bundle/Core/Event/TagsService.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,9 @@ public function loadTagByUrl(string $url, array $languages): Tag
return $this->service->loadTagByUrl($url, $languages);
}

public function loadTagChildren(?Tag $tag = null, int $offset = 0, int $limit = -1, ?array $languages = null, bool $useAlwaysAvailable = true): TagList
public function loadTagChildren(?Tag $tag = null, int $offset = 0, int $limit = -1, ?array $languages = null, bool $useAlwaysAvailable = true, ?string $sortBy = null, ?string $sortOrder = null): TagList
{
return $this->service->loadTagChildren($tag, $offset, $limit, $languages, $useAlwaysAvailable);
return $this->service->loadTagChildren($tag, $offset, $limit, $languages, $useAlwaysAvailable, $sortBy, $sortOrder);
}

public function getTagChildrenCount(?Tag $tag = null, ?array $languages = null, bool $useAlwaysAvailable = true): int
Expand Down
21 changes: 18 additions & 3 deletions bundle/Core/Pagination/Pagerfanta/ChildrenTagsAdapter.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,16 +11,23 @@
final class ChildrenTagsAdapter implements AdapterInterface, TagAdapterInterface
{
private ?Tag $tag = null;

private int $nbResults;
private ?string $sortBy = null;
private ?string $sortOrder = null;

public function __construct(private TagsService $tagsService) {}
public function __construct(private readonly TagsService $tagsService) {}

public function setTag(Tag $tag): void
{
$this->tag = $tag;
}

public function setSorting(?string $sortBy, ?string $sortOrder): void
{
$this->sortBy = $sortBy;
$this->sortOrder = $sortOrder;
}

public function getNbResults(): int
{
$this->nbResults = $this->nbResults ?? $this->tagsService->getTagChildrenCount($this->tag);
Expand All @@ -30,7 +37,15 @@ public function getNbResults(): int

public function getSlice($offset, $length): iterable
{
$childrenTags = $this->tagsService->loadTagChildren($this->tag, $offset, $length);
$childrenTags = $this->tagsService->loadTagChildren(
$this->tag,
$offset,
$length,
null,
true,
$this->sortBy,
$this->sortOrder,
);

$this->nbResults = $this->nbResults ?? $this->tagsService->getTagChildrenCount($this->tag);

Expand Down
4 changes: 2 additions & 2 deletions bundle/Core/Persistence/Cache/TagsHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -155,11 +155,11 @@ public function loadTagByKeywordAndParentId(string $keyword, int $parentTagId, ?
return $this->tagsHandler->loadTagByKeywordAndParentId($keyword, $parentTagId, $translations, $useAlwaysAvailable);
}

public function loadChildren(int $tagId, int $offset = 0, int $limit = -1, ?array $translations = null, bool $useAlwaysAvailable = true): array
public function loadChildren(int $tagId, int $offset = 0, int $limit = -1, ?array $translations = null, bool $useAlwaysAvailable = true, ?string $sortBy = null, ?string $sortOrder = null): array
{
$this->logger->logCall(__METHOD__, ['tag' => $tagId, 'translations' => $translations, 'useAlwaysAvailable' => $useAlwaysAvailable]);

return $this->tagsHandler->loadChildren($tagId, $offset, $limit, $translations, $useAlwaysAvailable);
return $this->tagsHandler->loadChildren($tagId, $offset, $limit, $translations, $useAlwaysAvailable, $sortBy, $sortOrder);
}

public function getChildrenCount(int $tagId, ?array $translations = null, bool $useAlwaysAvailable = true): int
Expand Down
2 changes: 1 addition & 1 deletion bundle/Core/Persistence/Legacy/Tags/Gateway.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ abstract public function getFullTagDataByKeywordAndParentId(string $keyword, int
*
* If $limit = -1 all children starting at $offset are returned.
*/
abstract public function getChildren(int $tagId, int $offset = 0, int $limit = -1, ?array $translations = null, bool $useAlwaysAvailable = true): array;
abstract public function getChildren(int $tagId, int $offset = 0, int $limit = -1, ?array $translations = null, bool $useAlwaysAvailable = true, ?string $sortBy = null, ?string $sortOrder = null): array;

/**
* Returns how many tags exist below tag identified by $tagId.
Expand Down
29 changes: 21 additions & 8 deletions bundle/Core/Persistence/Legacy/Tags/Gateway/DoctrineDatabase.php
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ public function getFullTagDataByKeywordAndParentId(string $keyword, int $parentI
return $query->execute()->fetchAll(FetchMode::ASSOCIATIVE);
}

public function getChildren(int $tagId, int $offset = 0, int $limit = -1, ?array $translations = null, bool $useAlwaysAvailable = true): array
public function getChildren(int $tagId, int $offset = 0, int $limit = -1, ?array $translations = null, bool $useAlwaysAvailable = true, ?string $sortBy = null, ?string $sortOrder = null): array
{
$tagIdsQuery = $this->createTagIdsQuery($translations, $useAlwaysAvailable);
$tagIdsQuery->andWhere(
Expand All @@ -137,10 +137,17 @@ public function getChildren(int $tagId, int $offset = 0, int $limit = -1, ?array
),
$tagIdsQuery->expr()->eq('eztags.main_tag_id', 0),
),
)->setParameter('parent_id', $tagId, Types::INTEGER)
->orderBy('eztags.keyword', 'ASC')
->setFirstResult($offset)
->setMaxResults($limit > 0 ? $limit : PHP_INT_MAX);
)->setParameter('parent_id', $tagId, Types::INTEGER);

if ($sortBy !== null && $sortOrder !== null) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should have an enum with allowed sorting property and sorting directions, so we don't need to pass direct values. This way, we would only allow sorting by predefined columns, and not besically anything the user sends down the method call chain.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added enums for sortBy and sortOrder: 4224d33
Also used enum cases to iterate over different options when selecting the property by which the user wants to sort the tags.

$tagIdsQuery->orderBy('eztags.' . $sortBy, $sortOrder);
} else {
$tagIdsQuery->orderBy('eztags.keyword', 'ASC');
}

$tagIdsQuery
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You don't need to separate setFirstResult and setMaxResults method calls from the main query builder calls.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I put it back together, after refactoring the whole process of sorting children tags

->setFirstResult($offset)
->setMaxResults($limit > 0 ? $limit : PHP_INT_MAX);

$statement = $tagIdsQuery->execute();

Expand All @@ -160,8 +167,13 @@ public function getChildren(int $tagId, int $offset = 0, int $limit = -1, ?array
[':id'],
),
)
->setParameter('id', $tagIds, Connection::PARAM_INT_ARRAY)
->orderBy('eztags_keyword.keyword', 'ASC');
->setParameter('id', $tagIds, Connection::PARAM_INT_ARRAY);

if ($sortBy !== null && $sortOrder !== null) {
$query->orderBy('eztags.' . $sortBy, $sortOrder);
} else {
$query->orderBy('eztags_keyword.keyword', 'ASC');
}

return $query->execute()->fetchAll(FetchMode::ASSOCIATIVE);
}
Expand Down Expand Up @@ -847,7 +859,7 @@ public function deleteTag(int $tagId): void
private function createTagIdsQuery(?array $translations = null, bool $useAlwaysAvailable = true): QueryBuilder
{
$query = $this->connection->createQueryBuilder();
$query->select('DISTINCT eztags.id, eztags.keyword')
$query->select('DISTINCT eztags.id, eztags.keyword, eztags.modified, eztags.priority')
->from('eztags', 'eztags')
// @todo: Joining with eztags_keyword is probably a VERY bad way to gather that information
// since it creates an additional cartesian product with translations.
Expand Down Expand Up @@ -930,6 +942,7 @@ private function createTagFindQuery(?array $translations = null, bool $useAlways
'eztags.remote_id',
'eztags.main_language_id',
'eztags.language_mask',
'eztags.priority',
// Tag keywords
'eztags_keyword.keyword',
'eztags_keyword.locale',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,10 +71,10 @@ public function getFullTagDataByKeywordAndParentId(string $keyword, int $parentI
}
}

public function getChildren(int $tagId, int $offset = 0, int $limit = -1, ?array $translations = null, bool $useAlwaysAvailable = true): array
public function getChildren(int $tagId, int $offset = 0, int $limit = -1, ?array $translations = null, bool $useAlwaysAvailable = true, ?string $sortBy = null, ?string $sortOrder = null): array
{
try {
return $this->innerGateway->getChildren($tagId, $offset, $limit, $translations, $useAlwaysAvailable);
return $this->innerGateway->getChildren($tagId, $offset, $limit, $translations, $useAlwaysAvailable, $sortBy, $sortOrder);
} catch (DBALException $e) {
throw new RuntimeException('Database error', 0, $e);
} catch (PDOException $e) {
Expand Down
4 changes: 2 additions & 2 deletions bundle/Core/Persistence/Legacy/Tags/Handler.php
Original file line number Diff line number Diff line change
Expand Up @@ -89,9 +89,9 @@ public function loadTagByKeywordAndParentId(string $keyword, int $parentTagId, ?
return reset($tag);
}

public function loadChildren(int $tagId, int $offset = 0, int $limit = -1, ?array $translations = null, bool $useAlwaysAvailable = true): array
public function loadChildren(int $tagId, int $offset = 0, int $limit = -1, ?array $translations = null, bool $useAlwaysAvailable = true, ?string $sortBy = null, ?string $sortOrder = null): array
{
$tags = $this->gateway->getChildren($tagId, $offset, $limit, $translations, $useAlwaysAvailable);
$tags = $this->gateway->getChildren($tagId, $offset, $limit, $translations, $useAlwaysAvailable, $sortBy, $sortOrder);

return $this->mapper->extractTagListFromRows($tags);
}
Expand Down
2 changes: 2 additions & 0 deletions bundle/Core/Persistence/Legacy/Tags/Mapper.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ public function createTagInfoFromRow(array $row): TagInfo
$tagInfo->alwaysAvailable = (bool) ((int) $row['language_mask'] & 1);
$tagInfo->mainLanguageCode = $this->languageHandler->load($row['main_language_id'])->languageCode;
$tagInfo->languageIds = $this->languageMaskGenerator->extractLanguageIdsFromMask((int) $row['language_mask']);
$tagInfo->priority = (int) $row['priority'];

return $tagInfo;
}
Expand All @@ -60,6 +61,7 @@ public function extractTagListFromRows(array $rows): array
$tag->alwaysAvailable = (bool) ((int) $row['language_mask'] & 1);
$tag->mainLanguageCode = $this->languageHandler->load($row['main_language_id'])->languageCode;
$tag->languageIds = $this->languageMaskGenerator->extractLanguageIdsFromMask((int) $row['language_mask']);
$tag->priority = (int) $row['priority'];
$tagList[$tagId] = $tag;
}

Expand Down
1 change: 1 addition & 0 deletions bundle/Core/Repository/TagsMapper.php
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ public function buildTagDomainList(array $spiTags, array $prioritizedLanguages =
'mainLanguageCode' => $spiTag->mainLanguageCode,
'languageCodes' => $languageCodes,
'prioritizedLanguageCode' => $prioritizedLanguageCode,
'priority' => $spiTag->priority,
],
);
}
Expand Down
4 changes: 3 additions & 1 deletion bundle/Core/Repository/TagsService.php
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ public function loadTagByUrl(string $url, array $languages): Tag
return $this->mapper->buildTagDomainObject($spiTag, $languages);
}

public function loadTagChildren(?Tag $tag = null, int $offset = 0, int $limit = -1, ?array $languages = null, bool $useAlwaysAvailable = true): TagList
public function loadTagChildren(?Tag $tag = null, int $offset = 0, int $limit = -1, ?array $languages = null, bool $useAlwaysAvailable = true, ?string $sortBy = null, ?string $sortOrder = null): TagList
{
if ($this->hasAccess('tags', 'read') === false) {
throw new UnauthorizedException('tags', 'read');
Expand All @@ -164,6 +164,8 @@ public function loadTagChildren(?Tag $tag = null, int $offset = 0, int $limit =
$limit,
$languages,
$useAlwaysAvailable,
$sortBy,
$sortOrder,
);

$tags = [];
Expand Down
4 changes: 3 additions & 1 deletion bundle/Core/SiteAccessAware/TagsService.php
Original file line number Diff line number Diff line change
Expand Up @@ -52,14 +52,16 @@ public function loadTagByUrl(string $url, array $languages): Tag
);
}

public function loadTagChildren(?Tag $tag = null, int $offset = 0, int $limit = -1, ?array $languages = null, bool $useAlwaysAvailable = true): TagList
public function loadTagChildren(?Tag $tag = null, int $offset = 0, int $limit = -1, ?array $languages = null, bool $useAlwaysAvailable = true, ?string $sortBy = null, ?string $sortOrder = null): TagList
{
return $this->innerService->loadTagChildren(
$tag,
$offset,
$limit,
$this->languageResolver->getPrioritizedLanguages($languages),
$this->languageResolver->getUseAlwaysAvailable($useAlwaysAvailable),
$sortBy,
$sortOrder,
);
}

Expand Down
24 changes: 23 additions & 1 deletion bundle/Resources/public/admin/css/style.css

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions bundle/Resources/sql/mysql/schema.sql
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ CREATE TABLE `eztags` (
`remote_id` varchar(100) NOT NULL default '',
`main_language_id` int(11) NOT NULL default '0',
`language_mask` int(11) NOT NULL default '0',
`priority` int(11) NOT NULL default '0',
PRIMARY KEY ( `id` ),
KEY `idx_eztags_keyword` ( `keyword`(191) ),
KEY `idx_eztags_keyword_id` ( `keyword`(191), `id` ),
Expand Down
1 change: 1 addition & 0 deletions bundle/Resources/sql/postgresql/schema.sql
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ CREATE TABLE eztags (
remote_id varchar(100) NOT NULL default '',
main_language_id integer not null default 0,
language_mask integer not null default 0,
priority integer not null default 0,
PRIMARY KEY (id),
CONSTRAINT idx_eztags_remote_id UNIQUE (remote_id)
);
Expand Down
7 changes: 7 additions & 0 deletions bundle/Resources/translations/netgen_tags_admin.en.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ tag.remote_id: 'Remote ID'
tag.tag_name: 'Keyword'
tag.translations: 'Translations'
tag.modified: 'Modified'
tag.priority: 'Priority'
tag.main_tag: 'Main tag'
tag.parent_tag: 'Parent tag'

Expand Down Expand Up @@ -43,6 +44,12 @@ tag.children.no_children: 'No tags found'
tag.subtree_limitations.title: 'Subtree limitations'
tag.subtree_limitations.no_limitations: 'No subtree limitations'

tag.subitems.title: 'Subitems'
tag.subitems.sort_by: 'Sort by'
tag.subitems.sort_order: 'Sort order'
tag.subitems.sort_order.ascending: 'Ascending'
tag.subitems.sort_order.descending: 'Descending'

tag.related_content.title: 'List of content related to tag'
tag.related_content.filter.content_type: 'Content type filter'
tag.related_content.filter.sort: 'Sort'
Expand Down
7 changes: 7 additions & 0 deletions bundle/Resources/translations/netgen_tags_admin.fr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ tag.remote_id: 'Identification à distance'
tag.tag_name: 'Mot-clé'
tag.translations: 'Traductions'
tag.modified: 'Modifié'
tag.priority: 'Priorité'
tag.main_tag: 'Tag principale'
tag.parent_tag: 'Tag parent'

Expand Down Expand Up @@ -43,6 +44,12 @@ tag.children.no_children: 'Pas de tags trouvés'
tag.subtree_limitations.title: 'Limites des sous-arbres'
tag.subtree_limitations.no_limitations: 'Aucune limite de sous-arbre'

tag.subitems.title: 'Sous-éléments'
tag.subitems.sort_by: 'Trier par'
tag.subitems.sort_order: 'Ordre de tri'
tag.subitems.sort_order.ascending: 'Ascendant'
tag.subitems.sort_order.descending: 'Descendant'

tag.related_content.title: 'Liste des contenus liés au tag'

tag.add.title: 'Nouveau tag'
Expand Down
6 changes: 6 additions & 0 deletions bundle/Resources/views/admin/tag/children.html.twig
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
<th>{{ 'tag.tag_name'|trans }}</th>
<th>{{ 'tag.translations'|trans }}</th>
<th>{{ 'tag.modified'|trans }}</th>
<th>{{ 'tag.priority'|trans }}</th>
</tr>
</thead>
<tbody>
Expand All @@ -48,6 +49,7 @@
{% endfor %}
</td>
<td>{{ child.modificationDate|date }}</td>
<td>{{ child.priority }}</td>
</tr>
{% endfor %}
</tbody>
Expand All @@ -71,6 +73,10 @@
{% endif %}
</div>
</form>

{% if tag is defined and not tag.isSynonym %}
{% include '@NetgenTags/admin/tag/tabs/subitems.html.twig' %}
{% endif %}
{% else %}
<p>{{ 'tag.children.no_children'|trans }}</p>
{% endif %}
Loading