$field->toBool()
Converts the field value into a proper boolean
$field->toBool(bool $default = false): bool
Parameters
Name | Type | Default | Description |
---|---|---|---|
$default |
bool |
false |
Default value if the field is empty |
Return type
bool
Example
<?php if ($page->hasHeader()->toBool()): ?>
<header>
<!-- Your code here -->
</header>
<?php endif ?>