Skip to content

NGSTACK-977 tags visibility #169

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 59 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
59 commits
Select commit Hold shift + click to select a range
0c21b61
NGSTACK-977 add 'isHidden' and 'isInvisible' properties to Tag object…
AntePrkacin May 23, 2025
71034c0
NGSTACK-977 update database schema to include 'is_hidden' and 'is_inv…
AntePrkacin May 23, 2025
981a985
NGSTACK-977 add support for 'isHidden' and 'isInvisible' properties i…
AntePrkacin May 23, 2025
d3dc59e
NGSTACK-977 add support for 'isHidden' and 'isInvisible' fields in tr…
AntePrkacin May 23, 2025
62ba8ad
NGSTACK-977 add 'Hide tag' button and its functionality in admin inte…
AntePrkacin Jun 4, 2025
0ee8a42
NGSTACK-977 add 'Unhide tag' button and its functionality in admin in…
AntePrkacin Jun 5, 2025
033de91
NGSTACK-977 fix bug when creating queries and update translations to …
AntePrkacin Jun 5, 2025
b47e3a5
NGSTACK-977 add functionality for hiding and unhiding selected childr…
AntePrkacin Jun 5, 2025
302837d
NGSTACK-977 throw 404 on frontend if tag is hidden
AntePrkacin Jun 5, 2025
fcabf76
NGSTACK-977 add 'disabled' property to hidden tags and disable adding…
AntePrkacin Jun 5, 2025
402ca4c
NGSTACK-977 add 'hidden' text after hidden tags in eztags content field
AntePrkacin Jun 6, 2025
f12c262
NGSTACK-977 fix php-cs-fixer and phpstan reports
AntePrkacin Jun 6, 2025
9813914
NGSTACK-977 add 'is_hidden' and 'is_invisible' fields to test databas…
AntePrkacin Jun 6, 2025
9987286
NGSTACK-977 fix TagsIntegrationTest by adding 'isHidden' and 'isInvis…
AntePrkacin Jun 6, 2025
c698f26
NGSTACK-977 update phpdocs and remove tag visibility information bein…
AntePrkacin Jun 6, 2025
f8bcf8d
NGSTACK-977 modify gateway to make the hidden tag also invisible
AntePrkacin Jun 6, 2025
e5b2f5f
NGSTACK-977 remove unnecessary cast to int for 'is_hidden' and 'is_in…
AntePrkacin Jun 6, 2025
7e88bdd
NGSTACK-977 add 'hidesynonym' and 'unhidesynonym' policies
AntePrkacin Jun 6, 2025
dece52c
NGSTACK-977 add translation domain and make tag visibility info trans…
AntePrkacin Jun 6, 2025
543afc4
NGSTACK-977 change all 'unhide' text to 'reveal' regarding the tags v…
AntePrkacin Jun 6, 2025
8b20a72
NGSTACK-977 make descendant tags who have one hidden parent stay invi…
AntePrkacin Jun 9, 2025
54ec1e9
NGSTACK-977 fix logic for revealing a hidden tag
AntePrkacin Jun 9, 2025
a61028b
NGSTACK-977 set 'is_hidden' and 'is_invisible' fields correctly when …
AntePrkacin Jun 9, 2025
45b2f03
NGSTACK-977 update logic for revealing a tag to handle both ancestor …
AntePrkacin Jun 9, 2025
e50dfdb
NGSTACK-977 fix a test for creating a tag by adding 'is_invisible' pr…
AntePrkacin Jun 9, 2025
69672a5
NGSTACK-977 add events for hiding and revealing a tag and add tests f…
AntePrkacin Jun 9, 2025
086e954
NGSTACK-977 add 'show_hidden' parameter in the configTreeBuilder and …
AntePrkacin Jun 10, 2025
4af3ecd
NGSTACK-977 inject configResolver into SiteAccessAware/TagsService, a…
AntePrkacin Jun 10, 2025
0f8c7dd
NGSTACK-977 add 'show_hidden' argument to necessary functions in the …
AntePrkacin Jun 10, 2025
75858b8
NGSTACK-977 add 'show_hidden' argument to necessary functions in the …
AntePrkacin Jun 10, 2025
d99a9d4
NGSTACK-977 update PHPDoc for hide and reveal methods and add ' (hidd…
AntePrkacin Jun 10, 2025
d09d660
NGSTACK-977 add ' (hidden)' next to tag keyword in the TagTreeData if…
AntePrkacin Jun 10, 2025
a6d7415
NGSTACK-977 update DoctrineDatabaseTest and TagsHandlerTest with test…
AntePrkacin Jun 10, 2025
eed05e2
NGSTACK-977 add 'hide_tag' and 'reveal_tag' data to the TagTree in Tr…
AntePrkacin Jun 11, 2025
37da894
NGSTACK-977 add visibility information for children when listing them…
AntePrkacin Jun 11, 2025
e69b243
NGSTACK-977 not show hidden tags when trying to search for them in ez…
AntePrkacin Jun 11, 2025
514e3d0
NGSTACK-977 update postgresql schema and legacy.yaml file with 'is_hi…
AntePrkacin Jun 11, 2025
81d4007
NGSTACK-977 update PHPDoc for isHidden and isInvisible Tag properties
AntePrkacin Jun 12, 2025
a720391
NGSTACK-977 modify 'tags_reveal' to 'tags_revealed' translation message
AntePrkacin Jun 12, 2025
a69c38c
NGSTACK-977 extract TagTreeText formatting into a separate function a…
AntePrkacin Jun 12, 2025
08ef43d
NGSTACK-977 add upgrade instructions for tag visibility to UPGRADE.md…
AntePrkacin Jun 17, 2025
550f0e3
NGSTACK-977 update hideAction() and revealAction() methods for hiding…
AntePrkacin Jun 23, 2025
4a174cc
NGSTACK-977 separate escape logic from the formatting logic for tag k…
AntePrkacin Jun 23, 2025
6692248
NGSTACK-977 rename 'showHidden' to 'showHiddenTags' parameter in conf…
AntePrkacin Jun 23, 2025
203dcd6
NGSTACK-977 add MySQL and PostgreSQL upgrade scripts for 'is_hidden' …
AntePrkacin Jun 23, 2025
ec62925
NGSTACK-977 fix a call to searchTags() method in FieldController
AntePrkacin Jun 23, 2025
c05ab16
NGSTACK-977 rename MoveTagsType form to MultiselectTagsType form and …
AntePrkacin Jun 24, 2025
07866bc
NGSTACK-977 update hideTagsAction and revealTagsAction methods in Tag…
AntePrkacin Jun 24, 2025
535890e
NGSTACK-977 add 'autocomplete_provide_hidden_tags' parameter to the c…
AntePrkacin Jun 24, 2025
96279be
NGSTACK-977 modify autoCompleteAction() method in FieldController to …
AntePrkacin Jun 24, 2025
9a00e4e
NGSTACK-977 make autocomplete suggestions not show invisible tags whe…
AntePrkacin Jun 26, 2025
cf15dfc
NGSTACK-977 add data about tag visibility when searching for tags in …
AntePrkacin Jun 26, 2025
fd4e11f
NGSTACK-977 fix tag converting to synonym process and merging process…
AntePrkacin Jun 26, 2025
c81ccef
NGSTACK-977 remove dump statements from 'hide' and 'reveal' twig temp…
AntePrkacin Jun 26, 2025
45cf8e6
NGSTACK-977 update 'is_hidden' check to 'is_invisible' check in metho…
AntePrkacin Jun 26, 2025
50a4c29
NGSTACK-977 fix revealing a hidden synonym by checking the 'main_tag_…
AntePrkacin Jun 26, 2025
40605b9
NGSTACK-977 update testConvertToSynonym to check 'is_invisible' property
AntePrkacin Jun 26, 2025
88fc80e
NGSTACK-977 add some missing translations for french langauge
AntePrkacin Jun 26, 2025
71a9102
NGSTACK-977 change policies to only have one for hiding and revealing
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
18 changes: 18 additions & 0 deletions bundle/API/Repository/Events/Tags/BeforeHideTagEvent.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<?php

declare(strict_types=1);

namespace Netgen\TagsBundle\API\Repository\Events\Tags;

use Ibexa\Contracts\Core\Repository\Event\BeforeEvent;
use Netgen\TagsBundle\API\Repository\Values\Tags\Tag;

class BeforeHideTagEvent extends BeforeEvent
{
public function __construct(private readonly Tag $tag) {}

public function getTag(): Tag
{
return $this->tag;
}
}
18 changes: 18 additions & 0 deletions bundle/API/Repository/Events/Tags/BeforeRevealTagEvent.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<?php

declare(strict_types=1);

namespace Netgen\TagsBundle\API\Repository\Events\Tags;

use Ibexa\Contracts\Core\Repository\Event\BeforeEvent;
use Netgen\TagsBundle\API\Repository\Values\Tags\Tag;

class BeforeRevealTagEvent extends BeforeEvent
{
public function __construct(private readonly Tag $tag) {}

public function getTag(): Tag
{
return $this->tag;
}
}
18 changes: 18 additions & 0 deletions bundle/API/Repository/Events/Tags/HideTagEvent.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<?php

declare(strict_types=1);

namespace Netgen\TagsBundle\API\Repository\Events\Tags;

use Ibexa\Contracts\Core\Repository\Event\AfterEvent;
use Netgen\TagsBundle\API\Repository\Values\Tags\Tag;

class HideTagEvent extends AfterEvent
{
public function __construct(private readonly Tag $tag) {}

public function getTag(): Tag
{
return $this->tag;
}
}
18 changes: 18 additions & 0 deletions bundle/API/Repository/Events/Tags/RevealTagEvent.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<?php

declare(strict_types=1);

namespace Netgen\TagsBundle\API\Repository\Events\Tags;

use Ibexa\Contracts\Core\Repository\Event\AfterEvent;
use Netgen\TagsBundle\API\Repository\Values\Tags\Tag;

class RevealTagEvent extends AfterEvent
{
public function __construct(private readonly Tag $tag) {}

public function getTag(): Tag
{
return $this->tag;
}
}
36 changes: 29 additions & 7 deletions bundle/API/Repository/TagsService.php
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ public function loadTagByUrl(string $url, array $languages): Tag;
*
* @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, ?bool $showHiddenTags = null): TagList;

/**
* Returns the number of children of a tag object.
Expand All @@ -89,7 +89,7 @@ public function loadTagChildren(?Tag $tag = null, int $offset = 0, int $limit =
*
* @return int
*/
public function getTagChildrenCount(?Tag $tag = null, ?array $languages = null, bool $useAlwaysAvailable = true): int;
public function getTagChildrenCount(?Tag $tag = null, ?array $languages = null, bool $useAlwaysAvailable = true, ?bool $showHiddenTags = null): int;

/**
* Loads tags by specified keyword.
Expand All @@ -104,7 +104,7 @@ public function getTagChildrenCount(?Tag $tag = null, ?array $languages = null,
*
* @return \Netgen\TagsBundle\API\Repository\Values\Tags\TagList
*/
public function loadTagsByKeyword(string $keyword, string $language, bool $useAlwaysAvailable = true, int $offset = 0, int $limit = -1): TagList;
public function loadTagsByKeyword(string $keyword, string $language, bool $useAlwaysAvailable = true, int $offset = 0, int $limit = -1, ?bool $showHiddenTags = null): TagList;

/**
* Returns the number of tags by specified keyword.
Expand All @@ -117,7 +117,7 @@ public function loadTagsByKeyword(string $keyword, string $language, bool $useAl
*
* @return int
*/
public function getTagsByKeywordCount(string $keyword, string $language, bool $useAlwaysAvailable = true): int;
public function getTagsByKeywordCount(string $keyword, string $language, bool $useAlwaysAvailable = true, ?bool $showHiddenTags = null): int;

/**
* Search for tags.
Expand All @@ -132,7 +132,7 @@ public function getTagsByKeywordCount(string $keyword, string $language, bool $u
*
* @return \Netgen\TagsBundle\API\Repository\Values\Tags\SearchResult
*/
public function searchTags(string $searchString, string $language, bool $useAlwaysAvailable = true, int $offset = 0, int $limit = -1): SearchResult;
public function searchTags(string $searchString, string $language, bool $useAlwaysAvailable = true, int $offset = 0, int $limit = -1, ?bool $showHiddenTags = null): SearchResult;

/**
* Loads synonyms of a tag object.
Expand All @@ -148,7 +148,7 @@ public function searchTags(string $searchString, string $language, bool $useAlwa
*
* @return \Netgen\TagsBundle\API\Repository\Values\Tags\TagList
*/
public function loadTagSynonyms(Tag $tag, int $offset = 0, int $limit = -1, ?array $languages = null, bool $useAlwaysAvailable = true): TagList;
public function loadTagSynonyms(Tag $tag, int $offset = 0, int $limit = -1, ?array $languages = null, bool $useAlwaysAvailable = true, ?bool $showHiddenTags = null): TagList;

/**
* Returns the number of synonyms of a tag object.
Expand All @@ -162,7 +162,7 @@ public function loadTagSynonyms(Tag $tag, int $offset = 0, int $limit = -1, ?arr
*
* @return int
*/
public function getTagSynonymCount(Tag $tag, ?array $languages = null, bool $useAlwaysAvailable = true): int;
public function getTagSynonymCount(Tag $tag, ?array $languages = null, bool $useAlwaysAvailable = true, ?bool $showHiddenTags = null): int;

/**
* Loads content related to $tag.
Expand Down Expand Up @@ -222,6 +222,8 @@ public function addSynonym(SynonymCreateStruct $synonymCreateStruct): Tag;
/**
* Converts $tag to a synonym of $mainTag.
*
* If $tag was hidden, it will remain hidden after converting
*
* @throws \Ibexa\Contracts\Core\Repository\Exceptions\NotFoundException If either of specified tags is not found
* @throws \Ibexa\Contracts\Core\Repository\Exceptions\UnauthorizedException If the current user is not allowed to convert tag to synonym
* @throws \Ibexa\Contracts\Core\Repository\Exceptions\InvalidArgumentException If either one of the tags is a synonym
Expand Down Expand Up @@ -286,6 +288,26 @@ public function newSynonymCreateStruct(int $mainTagId, string $mainLanguageCode)
*/
public function newTagUpdateStruct(): TagUpdateStruct;

/**
* Hides $tag.
*
* If $tag is a synonym, only the synonym is hidden.
*
* @throws \Ibexa\Contracts\Core\Repository\Exceptions\UnauthorizedException If the current user is not allowed to hide this tag
* @throws \Ibexa\Contracts\Core\Repository\Exceptions\NotFoundException If the specified tag is not found
*/
public function hideTag(Tag $tag): void;

/**
* Reveal $tag.
*
* If $tag is a synonym, only the synonym is revealed.
*
* @throws \Ibexa\Contracts\Core\Repository\Exceptions\UnauthorizedException If the current user is not allowed to reveal this tag
* @throws \Ibexa\Contracts\Core\Repository\Exceptions\NotFoundException If the specified tag is not found
*/
public function revealTag(Tag $tag): void;

/**
* Allows tags API execution to be performed with full access sand-boxed.
*
Expand Down
13 changes: 13 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,8 @@
* @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 bool $isHidden Indicates if the Tag object is visible or not
* @property-read bool $isInvisible Indicates if the Tag object is located under another hidden Tag object
*/
final class Tag extends ValueObject
{
Expand Down Expand Up @@ -104,6 +106,17 @@ final class Tag extends ValueObject
*/
protected ?string $prioritizedLanguageCode;

/**
* Indicates that the Tag is hidden.
*/
protected bool $isHidden;

/**
* Indicates that the Tag object is not visible, being either hidden itself,
* or implicitly hidden by parent or ancestor Tag object.
*/
protected bool $isInvisible;

/**
* Construct object optionally with a set of properties.
*
Expand Down
4 changes: 4 additions & 0 deletions bundle/Controller/Admin/FieldController.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,10 @@ public function autoCompleteAction(Request $request): JsonResponse
$searchResult = $this->tagsService->searchTags(
$request->query->get('searchString') ?? '',
$request->query->get('locale') ?? '',
true,
0,
-1,
$this->configResolver->getParameter('autocomplete_provide_hidden_tags', 'netgen_tags'),
);

$data = $data = $this->filterTags($searchResult->tags, $subTreeLimit, $hideRootTag);
Expand Down
Loading