Display Checkbox state in Panel


how i can display a checkbox state (like “approved” in my case) in a “nice way”?
At the Moment i only can print out “true” or nothing with

type: structure
entry: >

in my blueprint.

Also i’ doing something wrong here because i check the states different (“1” vs true):

<?php if( $page->commentsshow() == **"1"** ): ?>
<?php $comments = yaml($page->comments()->filterBy('approved', **true**)); ?>
  <ul class="">

Whats wrong there?

best Regards!

Hm, this is inconsistent. I briefly tested this with a freshly installed starter kit (Kirby 2.1.1) and get even more inconsistent behavior. The checkbox within the structure field shows “on” first and then changes to true. When the checkbox is not checked, there is no entry, not even the (sub)field name.

A normal checkbox results in a “1” for true, but IMHO should also result in “0” for false, but instead it is empty. Is this the expected behavior?

So I would consider this a bug. Could you pls. open an issue on GitHub?

As regards your first question: You can use text in the entry field like this:

entry: >
      Approved: {{approved}}

At least this would make it clearer as to what is meant here.

also experienced this.
only untill the page is saved in template. then it’s switching to true or empty.

@Svnt: Thanks for creating the issue: https://github.com/getkirby/kirby/issues/309. Could you pls. move it from the Kirby to the Panel repo, though?


Thank you for confirming this issue!

1 Like