1

I want to add a custom tab after "Edit" but can't figure out how to do so. I added a mymodule.links.task.yml file

entity.node.import_form:
  route_name: entity.node.import_form
  base_route: entity.node.canonical
  title: Import JSON from file

But I don't understand what to do next. The node form just errors out with:

Symfony\Component\Routing\Exception\RouteNotFoundException: Route "entity.node.import_form" does not exist. in Drupal\Core\Routing\RouteProvider->getRouteByName() (line 128 of /var/www/sites/datacenter.com/docroot/core/lib/Drupal/Core/Routing/RouteProvider.php).

2
  • Do you have defined entity.node.import_form in your $module.routing.yml file? Apr 21, 2015 at 14:15
  • 1
    I think I got confused looking at how Node adds an edit tab. I did not have a routing file, instead I looked at the node route provider class.
    – Kevin
    Apr 21, 2015 at 15:19

1 Answer 1

1

What you have done is to create a menu task on the route entity.node.canonical with the title of Import JSON from file which links to the route entity.node.import_form.

The error you are getting is because the route entity.node.import_form (the link of the task) doesn't exist. You have to either depend/enable the module that provides this route or create the route yourself.

1
  • This answer could be improved by providing information or a link on how to create the route yourself as mymodule.links.task.yml would seem to be his attempt to create the route himself.
    – Mark
    May 13, 2016 at 20:17

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.