0

I have a content/entity type called venue. On these venue nodes, there is a link to review the venue. When users click on this link, they are taken to a content creation page for a review content type. The content creation form has an entity reference field, populated automatically with Entityreference Prepopulate, so that the review is associated with the correct venue.

I would like to display information about the venue being reviewed (including name, address, etc.) on the review content creation form, for the purposes of clarification for the user. I'm assuming that there is some way to fetch this information since both the url (/node/add/review?field_venue_reference_review=9) and the reference field contain the NID for the venue.

What would be the best way to pull information from the venue node and display it in/above/near the review form? I've tried to do it using a views block with a contextual filter, but it seems that since the NID neither has its own place in the url, or is in the standard place that an NID would be placed on the url of a node page, views cannot detect it. There may be another way to do this that I'm not realizing.

Any help would be greatly appreciated, as I've being searching for an answer for quite some time. Thanks in advance for any help.

3 Answers 3

0

If I was faced with this problem I would look to views to help me solve it.

  1. Create a view for the review content type containing the fields you want to display.
  2. Add the entity reference relationship to that view.
  3. Pass the correct node id as the argument using that reference.
5
  • The problem that I can see with this is that when they are creating a review, they are actually creating content of type review. If I were to create a view for the content type, that would only show content that has already been created, correct? Or is there a way to utilize the view as the content creation page instead of the default create node page?
    – Mrweiner
    Commented Jun 14, 2012 at 20:42
  • Might be good to take another look at your model. I think a business content type to attach reviews to might make more sense and save you some headaches in the long run. Commented Jun 15, 2012 at 0:47
  • After seeking advice (and having no Drupal experience prior to creating this site) I have been informed that the best way to lay out the site is to have a business content type, and then a review content type, linked together with a reference field. This model has worked perfectly thus far, but as the site is still not live I am open to suggestions. Since you suggest that I should alter my site format, what would you suggest doing to relate reviews to the business pages/content type for the purposes of averaging ratings (cannot use fivestar) and displaying each review individually.
    – Mrweiner
    Commented Jun 15, 2012 at 18:21
  • Getting aggregates of anything that is in voting api (which fivestar is based on) is pretty easy but would involve a little custom code. I would have a view for business data on individual review nodes, and a view for a summary of review data on the business node both powered by entity references. Commented Jun 15, 2012 at 19:12
  • I guess I'm confused how you would have me provide the ratings form to users. In my current model I have a business content type/node (with average ratings through computed fields and display suite), with a link to "create a review". This links to a content creation page for the review content type, with a prepopulated entity reference field relating it to the business node. Maybe I'm stuck thinking of your solution in terms of my current setup, but I don't see how reviews are submitted in your model. But, you did give me an idea to create a view block containing the info I want to display.
    – Mrweiner
    Commented Jun 15, 2012 at 23:47
0

At the moment, there doesn't seem to be a way to do this. If I do find a way, I will update this.

0

Stumbled on this question whilst looking for something totally different. I think a good solution to this problem is actually http://drupal.org/project/field_collection as an embedded review solution. This means your users wont even have to leave the venue page in the first place to create a review. Together with some field permissions you can have so that only specific roles can create/edit the field collections.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.