Hi,
I have a selectfield for choosing a childrenpage as linktarget I call this with
if($page->bookingbtntarget()->isNotEmpty()): echo $page->bookingbtntarget()->toPage()->url(); endif;
but I get the error
Call to a member function url() on boolean
I’m a little bit confused because I proofed this and the ->toPage()->url()
is the right way to get the whole URL for the link.
If I delete the toPage()
it work but I got a wrong build url.
This is the blueprint:
hasbookingbtn:
label: Zeige Buchenbutton mit Link auf Reservierungsseite
text: Der Reservierungsbutton wird angezeigt wenn die Checkbox markiert ist.
type: checkbox
bookingbtntext:
label: Buchenbuttontext
type: text
bookingbtntarget:
label: Buchenbutton Link Ziel
type: select
default: reservierung
options: query
query:
fetch: children
value: '{{uid}}'
bookingbtncolor:
label: Buchenbutton Hintergundfarbe
type: pickacolor
And the Snippet:
<?php
if($page->hasbookingbtn()->bool()): ?>
<div class="bookingcom col-xs-24 col-sm-24 col-md-24 col-ld-24">
<a class="btn btn-red bookingbtn col-xs-20 col-sm-20 col-md-24 col-lg-24 ajaxlink" href="<?php if($page->bookingbtntarget()->isNotEmpty()): echo $page->bookingbtntarget()->toPage()->url(); endif; ?>" data-name="booking" <?php if(!$page->bookingbtncolor()->empty()): ?>style="background: <?php echo $page->bookingbtncolor()->value(); endif; ?>">
<?php echo html($page->bookingbtntext()) ?>
</a>
</div>
<?php endif; ?>