To manage taxonomies, use
Getting taxonomy entries¶
To get a single taxonomy entry, you can use
and provide it with the numerical entry ID.
Or pass entry identifier (with optionally a taxonomy identifier),
1 2 3
A taxonomy entry identifier is unique per taxonomy. If you have several taxonomies, you can increase code readability by always passing the taxonomy identifier even when it's the default one. The default taxonomy is
tags if it exists, else the first configured taxonomy (see
\Ibexa\Taxonomy\Service\TaxonomyConfiguration::getDefaultTaxonomyName for details).
1 2 3
You can also get a taxonomy entry from the ID of its underlying Content item, by using
To get the root (main) entry of a given taxonomy, use
and provide it with the taxonomy name.
To get all entries in a taxonomy, use
TaxonomyServiceInterface::loadAllEntries(), provide it with the taxonomy identifier,
and optionally specify the limit of results and their offset.
The default taxonomy identifier is given by
TaxonomyConfiguration::getDefaultTaxonomyName and is
'tags' on a fresh installation.
The default limit is 30.
To see how many entries is there, use
TaxonomyServiceInterface::countAllEntries() with optionally a taxonomy identifier.
To get all children of a specific taxonomy entry, use
provide it with the entry object, and optionally specify the limit of results and their offset.
The default limit is 30:
1 2 3 4 5
Managing taxonomy entries¶
You can move a taxonomy entry to a different parent by using
Provide the method with two objects: the entry that you want to move and the new parent entry:
1 2 3 4
You can also move a taxonomy entry by passing its target sibling entry to
The method takes as parameters the entry you want to move, the future sibling,
position parameter, which is either