How to edit Menu primary nav tab in Drupal 8 Page contains two nav bars with primary having View, Edit, Notes, Resend, Devel tabs and a secondary nav bar with Definition, Render, Load, Tokens. I am using css to not display particular tabs in primary and totally hiding the secondary nav bar. But, one of the requirement is to edit the name of a tab. I tried using theme_preprocess_menu_local_task hook but I am not able to edit the protected object values. What is the approach I need to take to edit the name of the tab. In this case 'resend' to 'forward'.

    function theme_preprocess_menu_local_task(&amp;$variables) { 
     if($variables['item']-&gt;text =='Resend'){
        $variables['item']-&gt;text = 'Forward';
     } 
    }


the above code bombs with error saying protected values cannot be accessed.
You may wish to use hook_local_tasks_alter() and/or hook_menu_local_tasks_alter() to hide/rename local tasks.