Why multilevel dynamic local tasks doesn't work? I want to have tabs, but since they need to be dynamic I am making use of local tasks. In the class extending DeriverBase I have written the following function:

public function getDerivativeDefinitions($base_plugin_definition) {
    $this-&gt;derivatives = array();
    foreach ($this-&gt;moduleFormatManager-&gt;getDefinitions() as $key =&gt; $definition) {
      $this-&gt;derivatives[$key]['title'] = $definition['title'];
      $this-&gt;derivatives[$key]['route_parameters'] = array('module_format' =&gt; $key);
      $this-&gt;derivatives[$key]['route_name'] = 'module.format_configure_' . $key;
      if($key == 'xyz') {
        $key = 'newkey';
      $this-&gt;derivatives[$key]['title'] = 'newkey';
      $this-&gt;derivatives[$key]['route_name'] = 'module.newkey';
      $this-&gt;derivatives[$key]['parent_id'] = "module.format_configure:xyz";
      }
    }
    foreach ($this-&gt;derivatives as &amp;$entry) {
      $entry += $base_plugin_definition;
    }
    return $this-&gt;derivatives;
  }


In the above code, a tab for each key is being generated: my problem is in the if condition. In the if condition I am trying to generate a sub tab for a particular type of tab by declaring parent_id. But the code doesn't work for me.

What changes should I introduce in order to make it work? I used this link to learn about local tasks. 

My module.links.tasks.yml file looks like this:

module.format_configure:
  title: 'Configuration'
  base_route: module.configure
  tab_root_id: module.configure
  deriver: 'path to deriver'


All the mentioned routes have been declared in *.routing.yml file.
You said your file is called module.links.tasks.yml. The correct filename is module.links.task.yml (note links word is pluralized, but task is not).