How to add a view tab to node edit form? I have two node bundles: events and registrations. Registrations have an entity reference field pointing to a given event.
I have a view, that list registrations with  some event and registrant information and a contextual filter for given event. I would like to add this view as a tab to Event node edit form so, that it would list current registrations to given event.
I managed to display the view on the edit form easily by adding the view to form render array with event nid as an argument for the contextual filter, but not sure, what are the possible ways to add view to a node edit form as a tab.
I'm assuming you mean &quot;Drupal tab&quot; when you say you want to display Views as a tab on the Event edit form. &quot;Drupal tabs&quot; are the &quot;View | Edit | Translate | Etc&quot; links that are usually visually styled as tabs.
Although, a Drupal tab is an independent page, it will not be like a Block within the Edit form, it will be just a link on the &quot;View | Edit&quot; menu, you'll have &quot;View | Edit | Registrations&quot;. This means you won't see registrations listed when you go to Edit (unless you add a Block to that page through regular procedure), you will see your Registration results when you visit the &quot;Registrations&quot; link/page.
Display a Views Page as one of Drupal tabs
You will need to have the &quot;Page&quot; Display in your Registrations Views. Page Displays have special Page settings that include the Path and Menu options. Additionally, you'll need to adjust the Contextual filter too, to only appear on Event type nodes.
You can combine these two settings to make that Views Page appear among the Drupal tabs of a set of links.
The Path needs to follow the logic of the set of links. In your case you have drupal tabs /node/[nid], /node/[nid]/edit etc. You'll want to set your Path to node/%node/registrations.
On the Menu you should choose the Menu tab option, fill in what you want the tab text to say (into &quot;Menu link title&quot;), choose a Parent, it can some menu you're not displaying anywhere if you don't need this page to appear as a menu item elsewhere. The Weight will affect the order on the Drupal tabs, enter a larger number (e.g. 50) to make sure it comes up at the end, and not before &quot;View&quot; or &quot;Edit&quot;.
You already have the Contextual filter configured and working, so you might not need to do anything else. Check that the Contextual filter ID from the &quot;Content&quot; Category with these settings:
When the filter value is NOT available
Provide default value
Content ID from URL
When the filter value IS in the URL or a default is provided
Specify validation criteria
Validator: Content
Content type Event
Set the option for the case when the argument doesn't validate to something that makes sense to you.
When you save this View and reload some Event node page you should be able to see the Registrations as a Drupal tab. Rebuild Drupal cache if it doesn't appear.