What is the equivalent of hook_menu_alter() to change a menu item type? I want to change the menu type in Drupal 8. In Drupal 7 we can achieve this using hook_menu_alter

function module_menu_alter(&amp;$items) {
  $items['admin/config/people/ip-blocking/default'] = array(
    'title' =&gt; 'Block IP Address',
    'type' =&gt; MENU_DEFAULT_LOCAL_TASK,
  );
}


Similarly I want to change the menu type in Drupal 8. How can I do it.
Thank You.
Drupal 8 has a new menu system, there is no hook_menu and no hook_menu_alter anymore.

If you want to alter an existing route, it is a little bit more complicated in comparison to Drupal 7.

In your module you have to create a class file at YOURMODULE/src/Routing/CLASSNAME.php that extends RouteSubscriberBase:

/**
 * @file
 * Contains \Drupal\YOURMODULE\Routing\RouteSubscriber.
 */

namespace Drupal\YOURMODULE\Routing;

use Drupal\Core\Routing\RouteSubscriberBase;
use Symfony\Component\Routing\RouteCollection;

/**
 * Listens to the dynamic route events.
 */
class RouteSubscriber extends RouteSubscriberBase {

  /**
   * {@inheritdoc}
   */
  protected function alterRoutes(RouteCollection $collection) {
    // Get the route you want to alter
    $route = $collection-&gt;get('system.admin_content');

    // alter the route...
  }
}


You can take the RouteSubsciber class of the node module as an example.

To let your RouteSubscriber be recognized you also have to create a YOURMODULE.services.yml file in the root of your modules directory:

services:
  node.route_subscriber:
    class: Drupal\YOURMODULE\Routing\RouteSubscriber
    tags:
      - { name: event_subscriber }


To get a better insight to the new menu system I would recommend the following articles:


D7 to D8 upgrade tutorial: Convert hook_menu() and hook_menu_alter() to Drupal 8 APIs
What Happened to Hook_Menu in Drupal 8?


Edit:
As mentioned by Berdir, the menu system has a different structure now, which has nothing to do with D7's menu system, so there is no such thing as a menu type anymore.