Skip to content
For AI agents: the complete documentation index is available at llms.txt; this page is also available as Markdown at index.md.

TaxonomyEntry field type

TaxonomyEntry is a field type that stores information about the parent entry in the taxonomy tree, placing the taxonomy entry (tag or product category) in the taxonomy structure.

Name Internal name Expected input
TaxonomyEntry ibexa_taxonomy_entry array

PHP API field type

Input expectations

A TaxonomyEntry field accepts an array with an Ibexa\Contracts\Taxonomy\Value\TaxonomyEntry object.

Type Description Example
array array with an Ibexa\Contracts\Taxonomy\Value\TaxonomyEntry object under the taxonomy_entry key see below

Example using an Ibexa\Taxonomy\FieldType\TaxonomyEntry\Value object:

1
2
3
4
5
use Ibexa\Contracts\Taxonomy\Service\TaxonomyServiceInterface;

/** @var TaxonomyServiceInterface $taxonomyService */
$taxonomyEntry = $taxonomyService->loadEntryByIdentifier('example_entry', 'tags');
$taxonomyEntryField = new \Ibexa\Taxonomy\FieldType\TaxonomyEntry\Value($taxonomyEntry);

Example using array:

1
2
3
4
5
6
use Ibexa\Contracts\Taxonomy\Value\TaxonomyEntry;

/** @var TaxonomyEntry $taxonomyEntry */
return [
    'taxonomy_entry' => $taxonomyEntry, // load Entry using TaxonomyService
];

Value object

Properties

Property Type Description
taxonomyEntry ?Ibexa\Contracts\Taxonomy\Value\TaxonomyEntry Stores selected taxonomy entry.

Constructor

The constructor accepts an Ibexa\Contracts\Taxonomy\Value\TaxonomyEntry object.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
// Constructor example
use Ibexa\Contracts\Taxonomy\Service\TaxonomyServiceInterface;
use Ibexa\Taxonomy\FieldType\TaxonomyEntry;

// Fetches TaxonomyEntry from TaxonomyService
/** @var TaxonomyServiceInterface $taxonomyService */
$taxonomyEntry = $taxonomyService->loadEntryByIdentifier('example_entry', 'tags');

// Instantiates a taxonomy entry value
$taxonomyEntryFieldTypeValue = new TaxonomyEntry\Value($taxonomyEntry);

String representation

taxonomyEntry string identifier or empty string if no Taxonomy Entry is selected.

Hash format

An array with taxonomy_entry key containing Ibexa\Contracts\Taxonomy\Value\TaxonomyEntry object or null.

Validation

No validation.

Settings

The field definition of this field type can be configured with the following options:

Name Type Default value Description
taxonomy string null Taxonomy from which you choose an entry.

Template rendering

The TaxonomyEntry field is rendered with the ibexa_render_field() Twig function.