Is there a way to insert a view in a node form?

Solutions

You need to use

<?php
views_embed_view($name, $display_id = 'default') 
?> 

to embed a view. Here is the doc for that.

With module_invoke(), you can display a view block wherever you like.

There are a number of modules that might do it (quotes included are from their project pages):

  • EVA: Entity Views Attachment:

    ... provides a Views display plugin that allows the output of a View to be attached to the content of any Drupal entity. The body of a node or comment, the profile of a user account, or the listing page for a Taxonomy term are all examples of entity content.

  • View reference:

    ... defines a field type View reference which creates a relationship to a Views display and allows the view to be displayed as the content of the field.

    This module is modelled on Node reference and usage is similar.

    Additionally, you may enter arguments for each view by a delimiter seperated list with support for PHP generated arguments.

  • Viewfield:

    ... provides a field that holds a reference to a View and renders it whenever the entity containing the field is displayed.

Tags: Views / Nodes / Forms

Similar questions

Drupal 7 Date - Is there a way to change field settings if there is data in it already?
Currently I am using the date module for drupal 7 and I already have stored data in the existing date field. I want to make changes to the date field by adding "Repeating Dates", but obviously I cannot since I have data in there already. The options I came up with are: Create a completely new date field for the content type with the additional "Rep...
Is there a way to find out how many activated, registered users there are?
I am seeking to track some KPIs for my site, one of which is the number of activated, registered users there are on the site. Is there a way to get this number?
What is the quickest way to dump a node to insert into a test case?
Is there a script, console, drush command etc that can dump a node in the format needed to create a test case? How can I rapidly fill out
Is there an easier way to print taxonomies in the tpl? I get this working code, but it should be a "shorter" way!
After a painful day and a half I get this code, that prints out in my node.tpl.php the taxonomy terms associated to that particular node that the user is viewing. It works just fine. As it is quite long I´ll just put the whole thing inside a module and into a variable, to just print that. The thing is that it should get an easier, better way to do ...
How to insert a View inside other View as the last row of the parent View?
I need to insert a View inside other View as the last row of the parent View. I know I can create a Attachtment but this will be shown before or after the rows of the parent view. I need it to be inserted as the last row of the parent view Let's say the parent view lists "basic pages" nodes and the inserted view lists "articles" nodes. Then the res...
Is there a way to intercept a list of NID's created by a view and use them as a filter for another view?
I am at the point in Drupal experience where I am attempting to solve site design challenges at the custom code level using Drupal and Views APIs. As usual, my apparently simple attempt to solve a problem has demonstrated to me how much I don't know yet! I have a node-reference field that points to a 'related facts' content used by many different c...

Also ask

We use cookies to deliver the best possible experience on our website. By continuing to use this site, accepting or closing this box, you consent to our use of cookies. To learn more, visit our privacy policy.