Default Values or unset Variables

Hi Community, me again … short Question:

I have added now the below Code to my Template:

<?php
if ( $page->sidebar()->bool() == 1 ) {
  echo 'col-sm-9';
} else {
  echo 'col-sm-12';
}
?>

Works fine! But as I have added the field in the Blueprint later (after I created all pages) there are many pages which doesn’t have this option filled out. How can I set a “default” or something like isset()? Or is the default of this field if it’s not present in the .txt files a “0”?

And how can I set a default in the Blueprint for the Toggle Field, seems like it’s missing in the Docs?

https://getkirby.com/docs/cheatsheet/panel-fields/toggle

This condition should simply be, $page->sidebar()->bool(), not ->bool() ==1.

Setting a default:

  toggle:
    label: Is this a featured page?
    type: toggle
    text: yes/no
    default: no 

If the field doesn’t exist or doesn’t have a value, the condition returns false.