mirror of
https://github.com/getgrav/grav-plugin-admin.git
synced 2025-11-04 20:36:03 +01:00
Fixed taxonomy field not listing existing options in Flex Pages
This commit is contained in:
@@ -6,6 +6,7 @@
|
||||
1. [](#bugfix)
|
||||
* Fixed missed highlight on the selected page in Parents field
|
||||
* Fixed notifications that would not be remembered as hidden
|
||||
* Fixed taxonomy field not listing existing options in Flex Pages
|
||||
* Fixed taxonomy field not working outside pages
|
||||
|
||||
# v1.10.0-rc.20
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
{% extends "forms/field.html.twig" %}
|
||||
|
||||
{% block field %}
|
||||
{% set object = form.object %}
|
||||
{% set taxonomies = taxonomies ?? field.taxonomies ?? admin.data('config/site').taxonomies ?? [] %}
|
||||
{% set parentname = field.name %}
|
||||
{% set options = field.options %}
|
||||
@@ -9,7 +10,11 @@
|
||||
{% for name in taxonomies %}
|
||||
{% set field_name = parentname ~ '.' ~ name %}
|
||||
{% set value = (form.value(field_name) ?? data.value(field_name) ?? default[name] ?? [])|array %}
|
||||
{% if object %}
|
||||
{% set sub_taxonomies = object.getFlexDirectory().getIndex().getDistinctValues(field_name) %}
|
||||
{% else %}
|
||||
{% set sub_taxonomies = (attribute(grav.taxonomy.taxonomy, name) ?? [])|keys %}
|
||||
{% endif %}
|
||||
{% set list = (options[name] ?? [])|merge(sub_taxonomies)|merge(value)|array_unique %}
|
||||
|
||||
{% set field = {
|
||||
|
||||
Reference in New Issue
Block a user