How can I add a Preview in JSON local task?
My link is exactly the same of entity.node.canonical, but I have to add a query string (?_format=json). I know how to add the local task, but I don't know how to append the query string to the URL.
Drupal Answers is a question and answer site for Drupal developers and administrators. It only takes a minute to sign up.
Sign up to join this communityYou 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