Hi,
My php is at best rusty, and I am struggling with the simplest of tasks
I am building my navigation and want an optional field (menu_title) to be used if it’s available otherwise fallback on title
To illustrate a var_dump of two menu items
// var_dump($child->menu_title());
object(Kirby\Cms\Field)#292 (1) {
["menu_title"]=>
string(25) "Engineering Visualisation"
}
object(Kirby\Cms\Field)#295 (1) {
["menu_title"]=>
NULL
}
NULL should evaluate to false, yes? Is that not what is being returned when I call the getter ->menu_title()
my first thought was I could use the following to output my anchor text
<?= ($child->menu_title() || $child->title())->html() ?>
even this fails
if (!($child->menu_title())) echo 'menu-title is null';
or
if(is_null($child->menu_title())) echo 'menu-title is null';
Thanks for any help.