Add a "view in JSON" local task

Solutions

You need to configure URL options in links.task.yml file. See Url::fromUri for details.

your_module.export:
  title: Export
  route_name: entity.node.canonical
  options:
    query: {_format: json}
  base_route: entity.node.canonical
Tags: Drupal 8

Similar questions

How to add an additional class to each element in the menu-local-task.html.twig template?
I need to change the admin tab template by adding my wrapper and class to it. This is the default code: My code: Currently, the "DefTabs__tabItem--active" class is added to the active link, but I need to add an additional CSS class "DefTabs__tabItem" to each DIV element. How can I do this?
How to add an icon in local task link ? (Drupal)
I would like to add an icon in the local task links in drupal. Im a newbie.. I have already tried several solutions like : With Markup: And also with an array... But I found nothing
Secondary Menu Tab (local task)
I was wondering if there is any good documentation out there on building second level tabs using the menu system. Here is some of the menu code in my module: I would like to have admin/settings/cvminterviews/interviewers/import Be a secondary tab to: admin/settings/cvminterviews/interviewers but the above code doesn't seem to do anything with it. A...
How to make a panel page the default local task
I've got a custom module providing local tasks like entity/%/edit and I'm trying to get entity/% to show up as the default local task. entity/% is defined as a Panel Page using the panels module. How do I do this? Whenever I change the menu type to "local task" or "menu tab" (or "default menu tab") the local tasks disappear from the display. This i...
Altering menu local task title
I'm trying to override the title of a system provided local task. I have the following code which works for uid 1 but not authenticated users: According to this issue this is expected behaviour for the time being. Is there another way round this?
Remove an item from "menu local task"
I need to remove "Create new account" from the tabs on /user page. I was suggested to use hook_menu, but: Further: I've found that there is also hook_menu_alter hook. But it does not work for me also. I created the following function for testing: I see no changes in /user page after I have added this function into the module,

Also ask

We use cookies to deliver the best possible experience on our website. By continuing to use this site, accepting or closing this box, you consent to our use of cookies. To learn more, visit our privacy policy.