Add option to generate local tasks tab

Created on 6 March 2021, about 4 years ago
Updated 26 January 2023, about 2 years ago

Problem/Motivation

Great module! But missing a couple necessary things. We are building pages with multiple view modes to highlight different aspects related to content. Specifically, I am adding view modes to a "project" content type, "billing" and "reports". Each of these will be built out using Layout Builder with different views related to the underlying project.

#2958369: Permissions by view mode β†’ covers the permissions, but there's still no easy way to add navigation to these pages.

Proposed resolution

Add an optional local task per configured view mode page.

✨ Feature request
Status

Active

Version

4.0

Component

Code

Created by

πŸ‡ΊπŸ‡ΈUnited States freelock Seattle

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

  • πŸ‡¨πŸ‡¦Canada chrisck BC, Canada

    If this is a challenge to build into the module, how can this be done programmatically via local tasks? Something like this?

    mymodule.links.task.yml
    mymodule.view_mode_page_name:
      route_name: view_mode_page.display_entity
      title: 'View Mode Name'
      route_parameters:
        view_mode: 'view_mode_machine_name'
        entity_type: 'node'
      base_route: entity.node.canonical

    mymodule.routing.yml
    mymodule.view_mode_page_name:
      path: '/node/{node}/view-mode-pattern'
      defaults:
        _controller: '\Drupal\view_mode_page\Controller\MainController::displayEntity'
      requirements:
        _permission: 'access content'

Production build 0.71.5 2024