How to include menu item in breadcrumb I've this breadcrumb I've created, where I would like to show it as

Home > Main menu > Sub menu

Where sub menu is connected to a node. So when a user click on node, it must show the breadcrumb of the above format.

I've done this, but it is only giving 

Home > Sub menu

Menu is missing.

function basis_preprocess_breadcrumb(&amp;$variables) {
  if (($node = \Drupal::routeMatch()-&gt;getParameter('node')) &amp;&amp; $variables['breadcrumb']) {
    $variables['breadcrumb'][] = array(
      'text' =&gt; $node-&gt;getTitle(),
      'url' =&gt; $node-&gt;URL()
    );

  }
}
Menu Breadcrumb might be what you're looking for.