When creating custom pages using views we might need to add them as tab to a node view for better accessibility. Here are two ways this can be implemented.
Option 1 - Configure Views page menu
Configure the menu settings for view
- go to PAGE Settings -> Menu
- Select Menu Type =
Tab. Parent can be any menu
Pros: defined menu inside the View page.
Cons: You must define your view path as
node/%node/..., otherwise it wont work.
Option 2- Define tab using
This can be define inside the file names
mymodule is your module name. Inside the file define a tab configuration
node.my_custom_tab: route_name: view.my_view.page_1 base_route: entity.node.canonical title: My Tab Title weight: 10
In th configuration above
node.my_custom_tabis the identifier of the tab link.
route_nameis the endentifier of the Views page. The format for views is
view.<view name>.<page mane>.
base_routeis how we specify to Drupal to on which pagers to show the tab.
Pros: You can name your module path anything you want. Cons: Your are going to have to create a module in order to define tab configuration.
Generally this is. better approach. Also when using Views you probably want to use a feature to hold your view. So creating a module is already done when defining a module as a feature.