Explicitly passing argument to local action for access check I'm using the group module, and in a custom module I'm trying to create a local task that will bring you directly to the create page for a particular group content type. My goal is to skip the create page where you select the content type.

I've defined a local task:

entity.group_content.create_form:
  route_name: entity.group_content.create_form
  title: 'Add new service'
  defaults:
    plugin_id: group_node:service
  appears_on:
    - 'view.group_services.page_1'


It doesn't complain about passing the $group for the access check, which I'm assuming is being successfully passed due to query magic. Where it breaks down is on $plugin_id on the access check with the error.


  RuntimeException: Callable "Drupal\group\Access\GroupContentCreateEntityAccessCheck::access" requires a value for the "$plugin_id" argument. in Drupal\Component\Utility\ArgumentsResolver->handleUnresolvedArgument() (line 142 of core/lib/Drupal/Component/Utility/ArgumentsResolver.php).


As an example, the route I'm trying to provide would end up being:

/group/{group}/content/create/{plugin_id}

aka

/group/1/content/create/group_node%3Aservice

What am I missing here?
Answered my own question. The key is that we are working with route parameters,  not route options which are akin to l() in Drupal 7.

This article goes into more detail. Here is the important part:

# yaml file to define one or more local task(s).
#
# Definitions can contain any of the following:
# title: (required) The untranslated title of the menu link.
# description: The untranslated description of the link.
# route_name: (optional) The route name to be used to build the path. Either a
#   route_name or a link_path must be provided.
# base_route: Used to group together related tabs.
# parent_id: Use the parent_id to relate a tab to a parent tab for multiple
#   levels of tabs.
# route_parameters: (optional) The route parameters to build the path. An array.
# link_path: (optional) If you have an external link use link_path instead of
#   providing a route_name.
# weight: (optional) An integer that determines the relative position of items
#   in the menu; higher-weighted items sink. Defaults to 0.
#   Menu items with the same weight are ordered alphabetically.
# options: (optional) An array of options to be passed to l() when generating
#   a link from this menu item.


So my action routing file is updated:

entity.group_content.create_form:
  route_name: entity.group_content.create_form
  title: 'Add new service'
  route_parameters:
    plugin_id: group_node:service
#  defaults:
#    plugin_id: group_node:service
  appears_on:
    - 'view.group_services.page_1'


Flush caches.