Module Description
This module adds support for creating menu local tasks with Views pages without writing YAML code. Although Drupal core provides a "Link to display" field that can be added to the view's header to add local task links, but that only works if all the pages that should have a local task link are in the same view. With this module, you can add local tasks (with the view's URL) to any page.


* Simply create a views Page, go to Menu settings.
* Set Type as Menu tab.
* Check "Local task only" (if you don't want a menu tab to be created with the local task)
* Fill in "Local task link title" (this is translatable via translating the view)
* Set "Local task parent". If the parent page is a view, you can select the proper views page here. This setting can be tricky because majority of the modules define this in modulename.links.task.yml files with custom IDs. If the parent page is not created by a view, you have to find the proper ID. (for example in case of the /admin/content page, it is system.admin_content). If you select "Custom", you can type in the proper parent_id.
* Optionally, set the local task's weight to change its position just like with the menu tabs.

One more thing: for example, if you want to add local tasks to the /node/13 page as /node/13/test and /node/13/another, then in the view you have to specify the URL to node/%node/test and node/%node/another (specify the entity type with its machine name) instead of node/%/test and node/%/another (as Drupal doesn't know what parameter is the %). The same goes with the other entities such as taxonomy_term, user, media etc. Otherwise it will produce an error until issue #3218981: Symfony\Component\Routing\Exception\MissingMandatoryParametersException: Some mandatory parameters are missing ("arg_0") to generate a URL for route is fixed.

Also, you cannot add a local task where the parent's URL doesn't contain the needed content ids. For example, you can't add /user/1/test as local task to /node/23 page, as one URL contains user ID, and the other a node ID. For this, you'll have to do it in a custom module programmatically.

Project Usage
172
Creation Date
Changed Date
Security Covered
Covered By Security Advisory
Version Available
Production
Module Summary
This module aims to solve the issue of creating menu local tasks with Views pages without the need to write YAML code, allowing for local task links to be added to any page with the view's URL.
Data Name
views_local_tasks

OPENAI CHATBOT

OPENAI CHATBOT

14:26:09
Generic Chatbot
Hi, I'm a Drupal module expert powered by OpenAI, answering your questions about the Drupal module ecosystem. How can I be helpful today? Please note that we will log your question.