EVA and Entity Reference Use Case How-to

This article describes the building of a practical example use case using modern Drupal 7 modules and site building techniques. I will show how to use Views, EVA, Fieldgroup, Entity Reference, Entity Reference Prepopulate, Display Suite modules to display content from multiple content types and other Drupal Entities on an article content type page. The goal is build a review system for the article content type.

Modules

Modules used in this how-to.

Display Suite

Display Suite allows you to take full control over how your content is displayed using a drag and drop interface. Arrange and configure the fields for your nodes, views, comments, user data etc. the way you want without having to work your way through dozens of template files.

https://drupal.org/project/ds

EVA

"Eva" is short for "Entity Views Attachment;" it 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. The EVA views display provides an interface in the Views UI attach a view as a field to any Drupal Entity. It also provides interface to select any value of the Entity that the EVA view field is attached to, as a contextual filter in the view. Allows the options and flexibility of views to be used in your content displays.

You can use EVA to display only fields values for a particular piece of content, giving incredible control over the display and formatting flexibility of the fields. For example you may desire to have two fields concatenated in some special way. You can add your fields to your EVA display, set the contextual filter to NID, add a Global: Text Field, and using tokens format your fields with HTML. Don’t forget to exclude your fields from display if you are going to use them together in a Global: Text Field. Example: You may have a city, state, and zip fields. You can combine them in a Global: Text Field in Views to display as “City, State ZIP”. When you manage the display for your content type add the EVA just created to the display and whenever a node the type is displayed it will pass its nid to the EVA and the EVA will return the fields you select, formatted as you desire.

https://drupal.org/project/eva

Entity Reference and Entity Reference Prepopulate

Entity Reference provides a field type that can reference arbitrary Drupal Entities. Entity Reference Prepopulate allows prepopulating any entity reference field via URL argument.

http://drupal.org/project/entityreference

https://drupal.org/project/entityreference_prepopulate

Fieldgroup

Fieldgroup will, as the name implies, group fields together. All fieldable entities will have the possibility to add groups to wrap their fields together. Fieldgroup comes with default HTML wrappers like vertical tabs, horizontal tabs, accordions, fieldsets or div wrappers

http://drupal.org/project/field_group

How-to Guide

Create a “Review” content type.

  • Add an entity reference field (Label: Article Reference fieldname:field_article_reference) to the view which will be prepopulated by a url argument via a link created by a custom Display Suite code field.
  • In the settings for the entity reference field in the “Additional behaviors” group check the “Entity reference prepopulate” checkbox. For the action property set Disable field. This shows the article that is referenced but doesn’t allow the user to change it when creating or editing review.
  • Create Display suite code field
  • Check the Node value for the Entities field. This will attach the custom field to Nodes (Content).
  • Enable tokens for the custom code field by checking the Token check box below theField Code
  • Set ‘Text Format’ to ‘Display Suite Code’ and create token html code for a link where field_article_reference is the name of the entity reference field created in step one and added to the article content type

Create a Review for Article EVA

  • Create a new view listing Content of Type Review
  • Add an EVA view display.
  • Enter a value for the view Title, "Reviews"
  • In the Entity content settings category
    1. Set Entity to Content (Nodes)
    2. Set Bundle to Article
    3. Leave Arguments set to id
  • Add a contextual filter that is the entity reference field of the Review content type.
    1. Add Contextual Filter: Content: Article Reference (field_article_reference)
    2. Under When the filter value is NOT available set hide view
  • Sort by postdate.
  • Display an unformatted list of Reviews teasers.

Add view to Article Display

  • Manage the display for the Article content type. For the Default or the Full Content display modes select custom display suite layout, for example (One Column)
  • Add a horizontal tab group Field group and two horizontal tab items Fieldgroups. Nest the two tab items in the tab group. Nest the article body and other fields (comments, links, title) in the first tab labeled “Article”.
  • Nest custom Display Suite Field second tab item labeled “Reviews”.
  • Nest the review list eva field in Reviews tab after the custom field.

Tags: 

Comments

the one of a kind ID of the

the one of a kind ID of the substance the view is appended to - and also any tokens created from that element - can be passed in as contentions to the view. For instance, you may make a View that presentations posts with a 'Creator ID' contention, Explainer Video Cost then utilize Eva to connect the view to the User substance sort. At the point when a client profile is shown, the User's ID will be passed in as the contention to the view mysteriously.

The Idaho state show a few

The Idaho state show a few tenets and specialists which are great. This state can now effortlessly actualize a few standards which are so imperative. Yet, I can state that Idaho state working so great and set the excellent model to the next state. The best chance to get <a href="http://www.researchpaperlabs.com/research-paper-editing/">Research Paper Editing</a> online which is the great helping material.

The entity is like the person

The entity is like the person and it is very important to know about the entity and entity instance in Druple. This software is so good and also so vast to understand all the features of this software. I am glad to visit your article and get custom essay that is really amazing tools to manage all kind of task.

Master

I simply seen choosing express the software once. Imply no matter I needed to check expectations with forthcoming you cannot help but stay on with regards to teaching this approach awesome live. visit this site

Great

Thanks for this article. You have menioned the same thing what was happened in my last few years. I am got too gloomy in these period and I regain this. Great work by you. AMazing. https://sites.google.com/site/domyessays/ is a blog which helps you to writer the essays and also will help you to find the best online writing service.

Pages

Add new comment

Filtered HTML

  • Web page addresses and e-mail addresses turn into links automatically.
  • Allowed HTML tags: <a> <em> <strong> <cite> <blockquote> <code> <ul> <ol> <li> <dl> <dt> <dd>
  • Lines and paragraphs break automatically.

Plain text

  • No HTML tags allowed.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Lines and paragraphs break automatically.
By submitting this form, you accept the Mollom privacy policy.