Open memtech3 opened 2 years ago
Maybe a similar issue: https://github.com/getgrav/grav-plugin-admin/issues/2217 I think I've fixed it for me.
I tried adding your code between line 72 and 73 but that doesn't seem to change the behavior even after I remove the keys and values saved as null from the page frontmatter.
{% if default_layout != 'key' %}
{% set originalValue = child_value %}
{% endif %}
@memtech3 I've created a modular/statpanels.yaml and a partials/icon.yaml with your content, but I cannot reproduce your issue. I did not changed anything in the code (Grav v1.7.25). The fields are still disabled even after I've saved the form.
This is what the frontmatter looks like:
title: Test
body_classes: modular
statpanels:
-
header: null
text: null
I just downloaded the latest version of grav+admin (1.7.26.1, 1.10.26.1), installed my theme in it, and I am still having the issue. Can you try installing my theme? The relevant code is on the main branch https://github.com/memtech3/duck-picnic. The module is called statpanels.
Some other info: I am running php -S localhost:8000 system/router.php on Ubuntu 21.10 with PHP 8 and the PHP 8 versions of all the required PHP extensions maybe this is a php 8 issue? maybe there are issues with the PHP 8 versions of the extensions?
I just noticed that the imageurl field toggle does not automatically toggle on like the rest of the fields
Ok I am hoping that I am understanding the problem and what you are trying to return but I ended up with a few little tweaks
statpanels.yaml
title: Stat Panels
'@extends': default
form:
fields:
tabs:
fields:
statpanels:
type: tab
title: Stat Panels
fields:
header.statpanels_section:
type: section
title: Page Headings
underline: true
header.statpanels:
type: list
collapsed: true
import@:
type: partials/icon
icons.yaml
form:
fields:
.icon:
type: iconpicker
label: Icon
toggleable: true
.color:
type: colorpicker
label: Icon Color
toggleable: true
.image:
type: mediapicker
folder: 'user/pages/images'
label: Select an image to use as an icon
preview_images: true
toggleable: true
.imageurl:
type: text
label: Input a url to use as an icon
toggleable: true
.header:
type: text
label: Header
toggleable: true
.smalltext:
type: text
label: Small Text
toggleable: true
.link:
type: text
label: Link
toggleable: true
which returned the data to statpanels.md
---
title: statpanels
body_classes: modular
statpanels:
-
icon: 'fa fa-file-o'
color: '#992828'
header: Testing
smalltext: Small
-
icon: 'fa fa-arrow-circle-o-down'
color: '#593e3e'
header: 2nd
---
Is this your required result ?
Issue
Empty page form fields marked toggleable: true are defaulting to enabled in admin. When the icon partial was tested on its own as a module empty fields defaulted to disabled. I have posted the relevant blueprints below.
All related code
The entire Grav installation used can be found at: https://github.com/memtech3/Duck-Picnic-Development-Environment The theme code used can be found at: https://github.com/memtech3/duck-picnic on the
icon-partial
branchBlueprints with import:
modular/statpanels.yaml
partials/icon.yaml
Blueprints for module without import:
modular/icon.yaml