use value returned from shortcode as menu item

Someone posted a similar question in the Advanced WordPress facebook group. I suggested adding some token text to the menu item’s url and then swapping it out during render.

add_filter( 'nav_menu_link_attributes', 'dcwd_nav_menu_link_attributes', 10, 4 ); 
function dcwd_nav_menu_link_attributes( $atts, $item, $args, $depth ) {
    // If PHONE_NUMBER is found then change it.
    if ( false !== strpos( $atts[ 'href' ], 'PHONE_NUMBER' ) ) {
        $atts[ 'href' ] = getPhone();
    }
    return $atts;
}

I also posted it to pastebin