When adding multiple variants to the node page to handle different node types, the tabs only appear on the first variant, reordering the variants allows the tabs to appear on whichever variant is first in the weighted list but not the subsequent variants.

Comments

Trey created an issue. See original summary.

berdir’s picture

abu-zakham’s picture

I am having the same issue

cyb_tachyon’s picture

Noting here that creating an additional Page Manager Page with a Panels variant and Node (Content) context assigned with an existing node also causes this issue, even if the same node is viewed at the provided /node/{node} page and displays tabs correctly there.

  1. Create a new node
  2. Create a variant for Page node/{node}
  3. View node at Page node/{node}
  4. Create a new Page and provide the node as a context using a new URL
  5. Create a new variant and add tabs, menus etc.
  6. Node visited at node/{node} still displays tabs, Node visited at the new URL does not

I might get time to debug it later, not sure.

m.abdulqader’s picture

Dirty solution for production site untill they solve the issue of route name

/**
 * Implements hook_menu_local_tasks_alter().
 */
function <MODULE_NAME>_menu_local_tasks_alter(&$data, $route_name) {

  // If route name match node router.
  if (strpos($route_name, 'entity.node.canonical') === 0 && $route_name != 'entity.node.canonical') {
    $manager = Drupal::service('plugin.manager.menu.local_task');
    $data['tabs'][0] = $manager->getLocalTasks('entity.node.canonical')['tabs'];
  }
}
emil stoianov’s picture

This problem is for all entities not only for 'node', I like the solution and would enhance it this way:

/**
 * Implements hook_menu_local_tasks_alter().
 */
function <MODULE_NAME>_menu_local_tasks_alter(&$data, $route_name) {
  $all_entity_types = \Drupal::getContainer()->get('entity.manager')->getDefinitions();
  foreach($all_entity_types as $entity_machine_name => $entity) {
    if (strpos($route_name, 'entity.'. $entity_machine_name. '.canonical') === 0 && $route_name != 'entity.'. $entity_machine_name. '.canonical') {
      $manager = Drupal::service('plugin.manager.menu.local_task');
      $data['tabs'][0] = $manager->getLocalTasks('entity.'. $entity_machine_name. '.canonical')['tabs'];
    }
  }
}

Thanks to Alexei Gorobets for consulting.

mikedotexe’s picture

#6 worked great for me. Thanks, gang!

mmenavas’s picture

#6 worked great for me too.

hkirsman’s picture

Last patch from ( #19 ) https://www.drupal.org/node/2634276 fixed my tabs.

tim.plunkett’s picture