I have a stuctured field. Extract from release.yml
reviews:
label: REVIEWS
type: structure
fields:
title:
label: Review Source Name
type: text
text:
label: Review Text
type: textarea
extract from release.txt
Reviews:
-
title: ALLMUSIC
text: Review text here....
with anything from 4 to 10 reviews in each release.
They are created in my test site through the panel’s textarea field. And they behave as expected there - in the panel and in pages when viewed
If I move my 40 content pages (files and release.txt). Half of the pages give errors in the panel.
Two kinds of errors:
Invalid value for “value”
Too many keys:
I have deleted all the review text in one such release.txt file and re-inserted it through the panel UI. That release then works. There are minor differences to the release.txt (e.g. use of “” and use of ‘|’ around or before the text: textarea), but I cannot see any major differences to explain the errors.
I’m faced with recreating all the review texts, and before I do that i thought I’d ask –
Why and how would this work in one install, break when moved to a fresh kirby install?
(I dont think I can upload a .txt file to show)
Looking at these in the php template where I used $item->text()->kirbytext(), to render the textarea, I get this error on one of the faulty release.txt content pages:
must be of type ?string, array given
So, I wonder why it thinks that some of these textarea fields hold arrays, in the new site installation, but apparently not in the old one.
What does the blueprint in the new installation look like?
It was the same template
# Each page blueprint must have a title, the title may be different from the file name
title: Release
# Each page can have an icon that is shown in page listings when no preview image is available.
icon: 🖼
# Page status can be limited, here to `draft` and `listed`.
# More about page status: https://getkirby.com/docs/reference/panel/blueprints/page#statuses
status:
draft: true
listed: true
# Define the form layout with two columns
# Columns are optional but help structure the form layout
# The first column defines an files section, the second a set of fields
# More about different types of sections: https://getkirby.com/docs/reference/panel/sections
# More about columns: https://getkirby.com/docs/guide/blueprints/layout#defining-columns
columns:
- width: 1/3
# The first column contains a set of fields to store
# information about the album.
#
# List of all available field types:
# https://getkirby.com/docs/reference/panel/fields
fields:
# If you need the same field in multiple locations, you can define them once and reuse whereever needed.
# Here we use a files field defined in `/site/blueprints/field/cover.yml`
coverImage: fields/cover
artist:
type: text
title:
type: text
cat_number:
help: PDxx
validate:
startsWith: PD
type: text
description:
help: CD with etc...
type: text
details:
help: Cover by... date...
type: text
press:
label: Press Release
type: textarea
side1name:
label: First Side or CD identifier
type: text
tracks1:
label: Tracks 1
type: structure
fields:
title:
label: Title
type: text
time:
label: Time
type: text
total1:
label: Total Time Disc or side 1
type: text
toggle2:
label: Second Disc or Side
type: toggle
side2name:
label: Second Disc or Side identifier
type: text
when:
toggle2: true
tracks2:
label: Second Disc or Side 2 Tracks
type: structure
fields:
title:
label: Second Disc or Side 2 Title
type: text
time:
label: Second Disc or Side 2 Time
type: text
when:
toggle2: true
total2:
label: Total Time Disc or Side 2
type: text
when:
toggle2: true
toggle3:
label: Third Disc or Side
type: toggle
side3name:
label: Third Disc or Side identifier
type: text
when:
toggle3: true
tracks3:
label: Third Disc or Side Tracks
type: structure
fields:
title:
label: Third Disc or Side Title
type: text
time:
label: Third Disc or Side Time
type: text
Number:
label: Number
type: number
when:
toggle3: true
total3:
label: Total Time Disc 3
type: text
when:
toggle3: true
toggle4:
label: Fourth Disc or Side
type: toggle
side4name:
label: Fourth Disc or Side identifier
type: text
when:
toggle4: true
tracks4:
label: Fourth Disc or Side Tracks
type: structure
fields:
title:
label: Fourth Disc or Side Title
type: text
time:
label: Fourth Disc or Side Time
type: text
Number:
label: Number
type: number
when:
toggle4: true
total4:
label: Total Time Disc 4
type: text
when:
toggle4: true
postcategory:
label: Postage Category
type: radio
required: true
default: cd1
options:
cd0: CD0
cd1: CD1
cd2: CD2
cd3: CD3
cd4: CD4
LP: LP
NA: NA
reviews:
label: REVIEWS
type: structure
fields:
title:
label: Review Source Name
type: text
text:
label: Review Text
type: textarea
alttoggle:
label: ALTERNATIVE RELEASE FORMAT
type: toggle
coverImage2: fields/cover2
altside1name:
label: First Side identifier (eg Side 1)
type: text
when:
alttoggle: true
alttracks1:
label: Side 1 Tracks
type: structure
fields:
title:
label: Track Title
type: text
time:
label: Time
type: text
when:
alttoggle: true
alttotal1:
label: Total Time Side 1
type: text
when:
alttoggle: true
altside2name:
label: Second Side identifier (eg Side 2)
type: text
when:
alttoggle: true
alttracks2:
label: Side 2 Tracks
type: structure
fields:
title:
label: Track Title
type: text
time:
label: Track Time
type: text
when:
alttoggle: true
alttotal2:
label: Total Time Side 2
type: text
when:
alttoggle: true
postcategory2:
label: Set Postage Category for LP
type: radio
required: true
default: LP
when:
alttoggle: true
options:
LP: LP
- width: 1/3
sections:
# The `images` files section shows all images of
# the current page that use the `image` template
images:
type: files
layout: cards
template: image
info: "{{ file.dimensions }}"
image:
ratio: 5/4
cover: true
min: 0
size: small
Finally this afternoon, I went through the release.txt files one by, deleting and replacing textarea entries – entry by entry to identifdy the broken fields. Eventually - it became apparent that 99% the broken fields had a ‘|-’ at the start of the field. And by trial and error, I found that by deleting the ‘-’, to leave just the bar ‘|’ fixed the error.