Better title might be 'How to set the menuItem object 'link' property?'
I've used menu overrides for a variety of purposes such as changing layout and styling etc but would now like to change the href of a menu item with a certain alias.
By default, the attributes are built like so:
$attributes = array();
if ($item->anchor_title)
{
$attributes['title'] = $item->anchor_title;
}
if ($item->anchor_css)
{
$attributes['class'] = $item->anchor_css;
}
if ($item->anchor_rel)
{
$attributes['rel'] = $item->anchor_rel;
}
Ideally I'd like something like:
switch ($item->alias) {
case 'specificAlias':
$attributes['href'] = "www.desired_link.com";
$linktype = $item->title;
break;
default:
$linktype = $item->title;
}
I've also tried this:
$item['link'] = "www.theDesiredLink.com";
I will be working out the URL dynamically which is why I can't set it manually for the menu item.