bnomei / kirby3-autoid

Automatic unique ID for Pages, Files and Structures including performant helpers to retrieve them. Bonus: Tiny-URL.
https://forum.getkirby.com/t/kirby3-autoid-plugin/23572
MIT License
80 stars 8 forks source link

Weird behaviour + error #3

Closed bvdputte closed 6 years ago

bvdputte commented 6 years ago

Bear with me as this is my first tryout with the autoid field! As a test I've tried adding an autoid to the blueprint of an article by adding this to the content section:

autoid:
  type: hidden

Now I'm getting following error when I'm trying to save an article: Undefined offset: 9 at /site/plugins/kirby3-autoid/classes/AutoID.php:187.

I'm also noticing the autoid field is not getting popuplated, but the tags field is being screwed up:

- 
  value: |
    -
    value: |
    -
    value: |
    -
    value: nature
    text: nature
    autoid: sxo3u5xg
    -
    value: sky
    text: sky
    autoid: zuvv49hx
    -
    value: starts
    text: starts
    autoid: 99872gys
    -
    value: tree
    text: tree
    autoid: cyl5mgas
    text: |
    -
    value: nature
    text: nature
    autoid: sxo3u5xg
    -
    value: sky
    text: sky
    autoid: zuvv49hx
    -
    value: starts
    text: starts
    autoid: 99872gys
    -
    value: tree
    text: tree
    autoid: cyl5mgas
    autoid: 4iip2yyx
    text: |
    -
    value: |
    -
    value: nature
    text: nature
    autoid: sxo3u5xg
    -
    value: sky
    text: sky
    autoid: zuvv49hx
    -
    value: starts
    text: starts
    autoid: 99872gys
    -
    value: tree
    text: tree
    autoid: cyl5mgas
    text: |
    -
    value: nature
    text: nature
    autoid: sxo3u5xg
    -
    value: sky
    text: sky
    autoid: zuvv49hx
    -
    value: starts
    text: starts
    autoid: 99872gys
    -
    value: tree
    text: tree
    autoid: cyl5mgas
    autoid: 4iip2yyx
    autoid: hwddoq10
  text: |
    -
    value: |
    -
    value: |
    -
    value: nature
    text: nature
    autoid: sxo3u5xg
    -
    value: sky
    text: sky
    autoid: zuvv49hx
    -
    value: starts
    text: starts
    autoid: 99872gys
    -
    value: tree
    text: tree
    autoid: cyl5mgas
    text: |
    -
    value: nature
    text: nature
    autoid: sxo3u5xg
    -
    value: sky
    text: sky
    autoid: zuvv49hx
    -
    value: starts
    text: starts
    autoid: 99872gys
    -
    value: tree
    text: tree
    autoid: cyl5mgas
    autoid: 4iip2yyx
    text: |
    -
    value: |
    -
    value: nature
    text: nature
    autoid: sxo3u5xg
    -
    value: sky
    text: sky
    autoid: zuvv49hx
    -
    value: starts
    text: starts
    autoid: 99872gys
    -
    value: tree
    text: tree
    autoid: cyl5mgas
    text: |
    -
    value: nature
    text: nature
    autoid: sxo3u5xg
    -
    value: sky
    text: sky
    autoid: zuvv49hx
    -
    value: starts
    text: starts
    autoid: 99872gys
    -
    value: tree
    text: tree
    autoid: cyl5mgas
    autoid: 4iip2yyx
    autoid: hwddoq10
  autoid: av99gup1

FFR: the original field content was

Tags: nature, sky, starts, tree
bnomei commented 6 years ago

i see. tags are also stored as yaml. my check if its a structures is messed up. will see what i can do. care to share the full blueprint? https://github.com/bnomei/kirby3-autoid/blob/master/classes/autoid.php#L194

bvdputte commented 6 years ago

Sure. It's basically the supplied article blueprint from the starterkit, but with the addition of the autoid field:

title: Article

num: date

icon: 📖

columns:
  - 2/3: content
  - 1/3: meta, images

sections:

  content:
    type: fields
    fields:
      text:
        label: Text
        type: textarea
        size: large
      autoid:
        type: hidden

  meta:
    type: fields
    fields:
      date:
        label: Date
        type: date
        time: true
        default: now
      author:
        label: Author
        type: user
      tags:
        label: Tags
        type: tags
        options: query
        query:
          fetch: site.tags.toStructure.sortBy("name", "asc")
          text: "{{ structureItem.name }}"
          value: "{{ structureItem.value }}"

  images:
    extends: sections/images
bnomei commented 6 years ago

please try again with https://github.com/bnomei/kirby3-autoid/releases/tag/v0.1.7

bvdputte commented 6 years ago

Fixed! 👍

bnomei commented 6 years ago

😅