calebgrove / select-a-structure

A select field for Kirby populated by a structure field.
43 stars 7 forks source link

ErrorException #4

Closed Mojo90 closed 7 years ago

Mojo90 commented 7 years ago

I just wanted to test your Plugin and unfortunately getting an error:

Method SelectAStructureField::__toString() must not throw an exception, caught Error: Call to a member function location() on boolean

This occurs even if just test with a simple minimal example and of course I followed your installation instruction. Maybe you have a fast shot? Thx!

screen shot 2017-04-26 at 15 23 24

Here you can see my fields. Could it be a problem that both are on the same page?

calebgrove commented 7 years ago

Well, that's strange. What version of PHP are you using? Can you copy/paste your blueprint here?

Mojo90 commented 7 years ago
<?php if(!defined('KIRBY')) exit ?>
title: Standorte-Termine
pages: false
files:
  type:
    - images
fields:
  title:
    label: Title
    type:  text

  section_01:
    label: Standorte
    type: headline
  location:
    label: Standort
    type: structure
    entry: >
      {{description}}
    fields:
      key:
        label: Eindeutige Bezeichnung (Bspw. herrenberg_horberstr) --> ohne Sonderzeichen
        type: text
        required: true
      description:
        label: Standort
        type: text
        required: true
      strasse:
        label: Straße und Hausnummer
        type: text
        width: 1/2
      plz:
        label: PLZ und Ort
        type: text
        width: 1/2
      openings:
        label: Öffnungszeiten + Theorieunterricht
        type: textarea
      text:
        label: Beschreibungstext
        type: textarea

  section_02:
    label: Termine
    type: headline
  calendar:
    label: Termin-Eintrag
    type: structure
    entry: >
      <strong>{{title}}</strong><br>
      {{description}}<br>
      Start: {{_begin_date}} {{_begin_time}}<br>
      Ende: {{_end_date}} {{_end_time}}
    fields:
      title:
        label: Titel
        type: text
        required: true
      standort:
        label: Standort
        type: selectastructure
        required: true
        structurepage: standorte_termine
        structurefield: location
        optionkey: key
      description:
        label: Beschreibung
        type: textarea
        size: small
      _begin_date:
        label: Startdatum
        type: date
        format: DD.MM.YYYY
      _begin_time:
        label: Startzeit
        type: time
        interval: 15
      _end_date:
        label: Enddatum
        type: date
        format: DD.MM.YYYY
      _end_time:
        label: Endzeit
        type: time
        interval: 15

PHP Version: 7.0.6

Mojo90 commented 7 years ago

Any Updates on this or can I support somewhere? Cause this is for finishing a customer website and not sure where I should start to debug

calebgrove commented 7 years ago

Sorry @Mojo90 for not getting back, I've been insanely busy the last couple of weeks. I'll try and see if I can duplicate your error today, but right now I can't promise much. :(

calebgrove commented 7 years ago

@Mojo90, check that you have the right structurepage set. Keep in mind that it needs to be the URI of the page, not the template.

calebgrove commented 7 years ago

Also, you shouldn't use key as your optionkey, as that name is used by Kirby for other purposes and it will confuse the system.

Mojo90 commented 7 years ago

Great help, thx now it works! Sorry for the confusion I really used the name template and not the URI even I read your short instruction of course. And you are right with key it does not work but now I simply use keyy. Thank you!! 😎👌🏿