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:

  route_name: entity.group_content.create_form
  title: 'Add new service'
    plugin_id: group_node:service
    - '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:




What am I missing here?

1 Answer 1


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:

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

Be sure to replace BUNDLE with the content type machine name you would like to pass.

Flush caches.

  • Thanks for sharing your answer! Just adding that under the plugin_id: group_node:service, service should be replaced by the content type machine name.
    – jozi
    Commented Apr 21, 2022 at 20:57
  • @jozi Yes, you are correct, sorry that was confusing! "service" was my machine name. I've clarified the answer. Commented May 6, 2022 at 16:23

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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