我为 base_route 创建了一个任务链接和一个上下文链接:entity.node.canonical
mymodule.routing.yml
mymodule.mycustomroute:
path: '/node/{node}/custom-path'
defaults:
_form: '\Drupal\mymodule\Form\MyForm'
requirements:
_permission: 'my permission'
node: '[0-9]+'
Run Code Online (Sandbox Code Playgroud)
mymodule.links.tasks.yml
mymodule.mycustomroute:
route_name: mymodule.mycustomroute
base_route: entity.node.canonical
title: 'my title'
Run Code Online (Sandbox Code Playgroud)
mymodule.links.contextual.yml
mymodule.mycustomroute:
route_name: mymodule.mycustomroute
group: node
Run Code Online (Sandbox Code Playgroud)
我的链接显示在我想要的每个节点上的查看/编辑/删除链接旁边。
现在我想知道如何才能使这些链接仅适用于特定节点类型?
drupal ×1