Closed Maybach91 closed 2 years ago
Can you confirm that this still happens with the latest version of the plugin? I can't reproduce it.
I'm having a similar issue where I try to check if the href exists to show or hide the button. I'm using the latest version of Kirby and also the latest version of the plugin. My code is:
<?php if ($page->button2()->toLinkObject()->href()->isNotEmpty()): ?> Button here <?php endif ?>
which gives the "Call to a member function href() on null" Also if I change it to popup() or title(). What can I do to get this to work?
You need to check if the link object itself is not null:
<?php if ($page->button2()->toLinkObject() !== null): ?> Button here <?php endif ?>
However, that will soon change due to a change in the plugin related to issue #61. But until then, you can use the snippet I posted above.
This is now changed in the new version of the plugin. Check the release notes.
I’m trying to get the URL of the link field like so:
I get the following error:
Call to a member function url() on null
Blueprint:
$link
has to following var_dump:And
$teammember->link()
the following var_dump:Whats wrong here? I just want the value. with
$teammember->link()->value()
i get the array as well.