getkirby-v2 / panel

This is the deprecated admin panel for Kirby v2.
http://getkirby.com
Other
134 stars 70 forks source link

Toggle field error #1063

Closed jenstornell closed 7 years ago

jenstornell commented 7 years ago

Kirby 2.5

fields:
  toggletext:
    type: toggle

Error Method ToggleField::__toString() must not throw an exception, caught Error: Call to a member function tag() on null

The weird thing is that when adding a label it works.

texnixe commented 7 years ago

I think this is related to this fix: https://github.com/getkirby/panel/issues/1032, if the label does not exist, it calls the tag method on null. Should be the same issue for all fields that extend the InputListField.

distantnative commented 7 years ago

Idea for line 18 in inputlist.php (https://github.com/getkirby/panel/commit/15637a3643285dd1018bffa3bf0feb51e13d8a48#diff-bb0a9bc663412fcb31404411408ccee2R18):

return !is_null($label) ? $label->tag('legend')->attr('for', false) : null;
lukasbestle commented 7 years ago

Fixed, thanks for investigating.