I have previously posted about a plugin I made to store author bios and then output them in various pages. With a LOT of help from @pamtbaau the plugin is almost ready for release. I am having one specific issue: when I upload an image to an author profile, the upload appears to complete, but when I hit save the page reloads and I get the message “Data type ‘authors’ doesn’t exist!”, and the image is nowhere to be seen. All other text input saves perfectly in user/data/authors/authors.yaml. I am intending for the images to save in user/images but something is amiss.
Beyond the issue above I’m also calling for a general review of the code if anyone is willing to point out anything I may have missed, potential improvements etc. Thanks.
The Aura Authors plugin as it stands is available here: https://github.com/matt-j-m/grav-plugin-aura-authors
It integrates closely with my original Aura plugin, the develop branch of which is sitting ready for its next major release to support Aura Authors: https://github.com/matt-j-m/grav-plugin-aura/tree/develop
Below is my blueprint for saving the author data and image.
Cheers
form:
name: authors
action: '/authors'
template: authors
refresh_prevention: true
fields:
authors:
type: list
display_label: false
collapsed: true
style: vertical
help: "Add or edit author details"
data-default@: ['\Grav\Plugin\AuraAuthorsPlugin::getAuthors']
fields:
.name:
type: text
size: large
label: Name
validate:
required: true
.label:
type: text
size: large
label: Taxonomy Label
validate:
pattern: "[a-z][a-z0-9_\-]+"
message: "Use all lowercase letters and replace spaces with hyphens."
required: true
.image:
type: file
size: large
label: Image
multiple: false
destination: 'user/images'
accept:
- image/*
.description:
type: textarea
size: long
label: Description
.person-facebook-url:
type: text
size: large
label: Facebook URL
placeholder: 'https://www.facebook.com/username'
.person-twitter-user:
type: text
size: large
label: Twitter Username
placeholder: 'username'
.person-instagram-url:
type: text
size: large
label: Instagram URL
placeholder: 'https://www.instagram.com/username'
.person-linkedin-url:
type: text
size: large
label: LinkedIn URL
placeholder: 'https://www.linkedin.com/in/name'
.person-pinterest-url:
type: text
size: large
label: Pinterest URL
placeholder: 'https://www.pinterest.com/user/username'
.person-youtube-url:
type: text
size: large
label: YouTube URL
placeholder: 'https://www.youtube.com/username'
.person-website-url:
type: text
label: Website URL
placeholder: 'https://www.example.com'
buttons:
submit:
type: submit
value: ' Save'
classes: button
id: authorSave