@pireba, To respond to your issue wrt the empty Taxonomy values in your static function…
Try the following function inside your theme (or plugin):
public static function taxonomyValues(string $taxon, string $fieldType)
{
/** @var Grav */
$grav = Grav::instance();
/** @var Admin */
$admin = $grav['admin'];
$admin->enablePages();
/** @var Taxonomy */
$taxonomy = $grav['taxonomy'];
$keys = $taxonomy->getTaxonomyItemKeys($taxon);
$values = [];
foreach ($keys as $key) {
if ($fieldType === 'select') {
$values[$key] = $key;
} else {
$values[] = [
'text' => $key,
'value' => $key,
];
}
}
return $values;
}
In combination with the following field definitions:
data-options@: ['\Grav\Theme\Quark::taxonomyValues', 'category', 'select']
data-options@: ['\Grav\Theme\Quark::taxonomyValues', 'tag', 'selectize']
Notes;
- Replace Quark with the name of your theme.
- The 2nd parameter
select|selectize
, might not be needed in your case. It’s just to show that different returns types are required depending on the field type.