AugustMiller / kirby-architect

📐 Easily reference Blueprint data from anywhere in your Kirby application.
38 stars 1 forks source link

Error Call to a member function locale() on null #10

Open meentix opened 6 years ago

meentix commented 6 years ago

Hi,

I receive the error "Call to a member function locale() on null" (architect.php line 77) and I dont know why.

My code is:

<?php foreach($page->kategorie()->split(',') as $category): Architect::field_option_label('sehenswert', 'kategorie', $category); endforeach ?>

I have a blueprint with the name "sehenswert" and a field of the type checkboxes with the name "kategorie". It has multiple options and $category is a valid value...

AugustMiller commented 6 years ago

For reference, this is the line in question.

This is related to #1, in that the plugin only works for multi-language installs, at the moment.

Currently, the only fix is to enable multi-language support in your Kirby project—even if you only have a single language: https://getkirby.com/docs/languages/setup

See the “Switching from single-language to multi-language” section. You'll need to re-name all your content files from template-name.txt to template-name.de.txt.

A fix for this is still on my to-do list! Sorry it's taken so long to get to.

meentix commented 6 years ago

What a pitty, as for now I'm going with this mapping "solution": https://getkirby.com/forum/archive/general/20141013/is-there-an-easy-way-to-get-the-label-of-checkboxes until you have fix it (because I dont want to activate multi language only for this).

calebgrove commented 5 years ago

Although this is untested, it looks like you can simply comment out line 64 and line 77 to make this plugin work on a single-lang website.