Setting up Entity Reference content types, fields, views with Entity Reference Prepopulate add links

First, modules:

  • Views + CTools
  • Entity Views Attachments
  • Entity Reference 7.x-1.0-rc1
  • Entity reference prepopulate 7.x-1.0
  • References dialog 7.x-1.0-alpha3

Then, content types and fields:

  • Create four or more content types. For this example, I will use Client, Work, Task, and Note. Tasks and Notes can be 'attached to', e.g. entity reference, Client and Work nodes. Also, Work nodes can be attached to Clients. In my use case, I have several other content types, which can 'have' Tasks and Notes as well. The other content types in my use case also have entity references to Client and Work nodes.
  • Client is the ultimate parent content type, so you don't need any entity reference fields on it (unless you want them for some other purpose, of course).
  • On the Work content type, create an Entity Reference field using the autocomplete widget, called 'Client'. You can make it required if you want, but it does not have to be.
    • Check the "Enable Entity reference prepopulate" box, select "Disable field" for Action and "Do nothing" for Fallback behaviour. I usually set Skip access permission to "Administer site configuration".
    • If you want to enable the References Dialog widget to be able to add/edit a Client from the node add page for a Work, check the Edit and Add dialog boxes

  • In the 'Client' field settings, leave the Number of values at 1, Target type is "Node", and select "Client" for the Target bundles

  • Now, on the node add page for the Work content type, you will see the Client Entity Reference Field, with the Add Client link supplied by the References Dialog module:

  • Then, on your Task and Note content types, create (separate) Entity Reference fields called 'Attached to' (machine names: field_task_attachedto and field_note_attachedto), that can reference an unlimited number of Client, Work, and whatever other content types that you desire. You should use different fields for ease of management, but the settings are the same.
    • Check the "Enable Entity reference prepopulate" box, select "Disable field" for Action and "Do nothing" for Fallback behaviour. Set Skip access permission to "Administer site configuration".
    • You will not be able to use the References Dialog links since you are enabling the field to reference an unlimited number of different content types. With child content like "notes" and "tasks", you presumably are not going to be creating a parent, like a "client", when you are creating a "note" for the "client" - the "client" parent node will already exist.

  • In the Attached to field settings, select "Unlimited" for the Number of values, set the Target type to "Node", and select the Client, Work and any other content types to which you want to be able to attached Notes and Tasks under Target bundles.

  • Remember to create your "Attached to" Entity Reference field on both your Note and Task content types. If you recycle the field, it will have the same settings for both Notes and Tasks, so if you want to be able to attach Notes, but not Tasks, to some content types, then use two separate fields with the same settings.
  • First, create your Views to display the Notes and Tasks attached to a referencable node being viewed. I also have pages to display all of the Notes and Tasks, but I want to be able to see all of the Notes and Tasks attached to a Client or Work on the Client and Work nodes. Here, Entity Views Attachments (which is a great and useful module) comes into play. I'll use the example of Tasks again, but the process is basically the same for Notes - just change anything that was specific to Tasks to Notes when creating that View.
    • At admin/structure/views, click the "Add new view" link, name it something like "Attached Tasks" and select Show Content of type Task. Uncheck create a page, and leave create a block unchecked.
    • Use the "+Add" button near the top, to add an "Entity content" display to your newly created View
    • Under the "Entity Content Settings" pane, select "Node" for the "Entity type", and select the content types that can be referenced by the "Attached to" Entity Reference field on the Task content type (e.g., Client, Work, etc.). Leave Arguments at id. I opted to display the title of the View display by selecting "Yes" for Show title.
    • Add the fields that you want to display. Title is fine for now.
  • Then create your contextual filter, so that this Entity Views Attachment display only shows on content types referencable by the Attached to field on the Task content type, and to show only the Tasks that are attached to the node being viewed.
    • Expand the "Advanced" pane, and click the "add" button next to Contextual Filters to add your new Contextual Filter.
    • Select the "Attached to" field (machine name: field_task_attachedto), which will be listed as "Content: Attached to (field_task_attachedto)" to use as the Contextual Filter.
    • Under When the Filter in Not Available, select the "Provide default value" radio button, and then select "Content ID from URL".
    • Under When the Filter Value is Available or a Default is Provided, check the "Specify validation criteria" radio button, select "Content" for the Validator, and then select all of the content types that can be referenced by the Attached to field on Tasks (Client, Work, etc.). 
    • Leave the select list option for Action to take if filter value does not validate to "Hide view", which is the default and the desired behavior.
    • Click the apply button to save the new contextual filter that makes the magic happen!

Basic Entity Content View Display set-up:

Configuration for Contextual Filter on Content: Attached to (field_task_attachedto):

  • Now, after saving your new View, you will see Tasks listed on the nodes that are "attached to"/referenced by Tasks. Note, there is currently a bug in Entity Views Attachment that does not automatically make the Entity Content display available on content types. First go to the "Manage fields" tab for the content types, and then go to the "Manage display" tab. You should now see the Entity Content display field for the View you created, and you can position it where you would like in relation to any other fields. Here is a shot of what a Client node should look like, after you have created the Client and an attached Task:

  • Repeat the basic process of creating the EVA View to display Tasks attached to a node for the Note and Work content types. You can also display the View in a block instead of an EVA, which will allow you to display the child content type attached to a node in the sidebar or other regions of your theme.
  • Next, create the Views to be able to display "Add new [child_content_type]" links on parent nodes. Like with displaying the child content on parent nodes, you can use an EVA or a block to display the "Add new [child_content_type]" links on the parent nodes. This example will use creating the link in an EVA for the Tasks content type, but the basic process can be repeated for Notes, Works, or any other child content types - just make sure to use the correct fields and filters applicable to the work. Finally, Entity Reference Prepopulate comes into play:
    • At admin/structure/views, click the "Add new view" link, name it something like "Add new child links" and select Show Content of type All. Uncheck create a page, and leave create a block unchecked.
    • Use the "+Add" button near the top, to add an "Entity content" display to your newly created View
    • Under the "Entity Content Settings" pane, select "Node" for the "Entity type", and select the content types that can be referenced by the "Attached to" Entity Reference field on the Task content type (e.g., Client, Work, etc.). Leave Arguments at id. I opted to not display the title of the View display by leaving "No" set for Show title.
    • Add the "Content: Nid" field to your View, and remove the Title field.
    • For your filters, set the "Content: Type" filter to show only the content types that can be referenced by your "Attached to" field on the Tasks content type.
    • Change the page options so that you only display one piece of content (which will happen automatically once you set the contextual filter for this view).
  • Now, you need to set up your contextual filter on this display so that it is used only in the context of a node which can be referenced by your "Attached to" field on the Tasks content type.
    • Expand the "Advanced" pane, and click the "add" button next to Contextual Filters to add your new Contextual Filter.
    • Select "Content: Nid", listed as "Content: Nid" to use as the Contextual Filter.
    • Under When the Filter in Not Available, select the "Provide default value" radio button, and then select "Content ID from URL".
    • Under When the Filter Value is Available or a Default is Provided, check the "Specify validation criteria" radio button, select "Content" for the Validator, and then select all of the content types that can be referenced by the Attached to field on Tasks (Client, Work, etc.). 
    • Leave the select list option for Action to take if filter value does not validate to "Hide view", which is the default and the desired behavior.
    • Click the apply button to save the new contextual filter, and then save your view.

Basic Entity Content Views Display set-up:

Contextual filter configuration:

  • The final step on this View to make it usable is to rewrite your NID field so that it is output as a link on a parent node to add a new Task node with its "Attached to" field properly referencing the parent.
    • Click on the "Content: Nid" field, and uncheck the "Create a label" box
    • Expand the "Rewrite Results" section, and check the "Rewrite the output of this field" box
    • In the Text box, enter <ul><li><a href="/node/add/task?field_task_attachedto=[nid]">Add new Task</a></li></ul>
    • In the node/add/task part of the above, 'task' is the machine name of the child content type Task, and field_task_attachedto is the Entity Reference field on the child content type that can reference the parent node being viewed. Basically, with Entity Reference Prepopulate, the above link tells Drupal to go to the create new node page for a Task with the "Attached to" field pointing to the parent node being viewed. For the Notes content type and its "Attached to" field, the rewritten link will look like <ul><li><a href="/node/add/note?field_note_attachedto=[nid]">Add new Note</a></li></ul>

Now, when viewing a parent content type like a Client, you will see the Tasks attached to that client, and a link to add a new Task node from the Client. Once the Views for the Note content type are set-up, you will see the whole deal:

Drupal version: 

Comments

adidas ultra boost

An fascinating discussion is worth comment. I feel that you need to write extra on this topic, it won't be a taboo subject however typically individuals are not sufficient to talk on such topics. To the next. Cheers

yeezy boost 350 v2

Spot on with this write-up, I actually suppose this web site needs far more consideration. I抣l in all probability be once more to learn much more, thanks for that info.

kyrie shoes

I would like to express some appreciation to the writer just for bailing me out of such a crisis. As a result of searching through the online world and getting tricks that were not powerful, I believed my life was over. Being alive without the strategies to the problems you've resolved through your good posting is a crucial case, and ones that could have in a negative way damaged my entire career if I had not discovered your web blog. Your good ability and kindness in controlling all the things was valuable. I am not sure what I would've done if I had not come upon such a point like this. I can at this moment relish my future. Thanks very much for the high quality and sensible guide. I won't hesitate to endorse your site to any person who would need direction about this topic.

supreme

I must express appreciation to this writer just for rescuing me from such a incident. After surfing throughout the world-wide-web and coming across notions which were not powerful, I believed my entire life was over. Being alive minus the solutions to the issues you've solved by means of your good site is a serious case, and the kind that would have in a negative way damaged my entire career if I had not come across your web blog. Your actual skills and kindness in taking care of almost everything was crucial. I'm not sure what I would have done if I had not discovered such a stuff like this. I am able to at this point relish my future. Thank you very much for the professional and result oriented guide. I won't be reluctant to recommend the website to any person who needs to have support about this area.

kd shoes

Thanks so much for providing individuals with a very brilliant chance to read articles and blog posts from this blog. It can be so pleasant plus jam-packed with fun for me and my office mates to search your website nearly thrice in 7 days to read through the latest stuff you will have. And indeed, I'm at all times impressed with your awesome concepts you give. Certain 1 points in this posting are clearly the most effective I've had.

goyard handbags

A lot of thanks for all of your work on this blog. My mum enjoys carrying out investigation and it is obvious why. Many of us notice all of the lively means you create rewarding guides by means of the blog and as well attract contribution from others on that theme then our child is certainly studying a lot. Have fun with the remaining portion of the year. You are performing a superb job.

golden goose outlet

I must get across my respect for your kindness supporting individuals that should have help with this important question. Your special dedication to passing the solution all over turned out to be certainly beneficial and has regularly encouraged individuals just like me to arrive at their pursuits. Your personal warm and friendly useful information entails a lot to me and especially to my mates. Thanks a lot; from everyone of us.

moncler

I wanted to create you a little note to help thank you very much the moment again considering the magnificent tips you've documented here. It has been wonderfully generous of people like you to grant publicly all that most of us could possibly have supplied as an electronic book in making some dough for their own end, notably since you could possibly have done it in case you decided. These thoughts additionally acted to be the easy way to be sure that someone else have similar fervor really like my very own to grasp great deal more when it comes to this problem. Certainly there are many more fun opportunities ahead for those who look over your website.

longchamp

I wanted to write you a very little remark so as to thank you so much as before on the superb secrets you have shown here. It is really tremendously generous of you to supply easily exactly what a few individuals would have distributed as an e-book to generate some bucks for their own end, especially considering the fact that you could possibly have tried it in case you decided. The points likewise worked like a fantastic way to fully grasp that other people online have a similar keenness much like my very own to realize many more on the topic of this issue. I believe there are several more fun times ahead for individuals who go through your blog post.

balenciaga shoes

I am just commenting to make you understand of the wonderful discovery my friend's child obtained reading through your web site. She picked up a wide variety of details, which include what it is like to possess an awesome coaching mood to have the rest completely understand several complex topics. You undoubtedly surpassed readers' expected results. I appreciate you for displaying those priceless, trustworthy, revealing and as well as fun tips on this topic to Julie.

hermes birkin

An impressive share, I simply given this onto a colleague who was doing just a little analysis on this. And he in fact purchased me breakfast because I found it for him.. smile. So let me reword that: Thnx for the deal with! But yeah Thnkx for spending the time to debate this, I really feel strongly about it and love studying extra on this topic. If attainable, as you turn out to be expertise, would you thoughts updating your weblog with more details? It's extremely helpful for me. Massive thumb up for this weblog submit!

coach factory outlet

After I originally commented I clicked the -Notify me when new feedback are added- checkbox and now every time a remark is added I get four emails with the identical comment. Is there any means you can remove me from that service? Thanks!

yeezy boost 350

An interesting dialogue is worth comment. I believe that it's best to write more on this topic, it might not be a taboo subject but generally individuals are not sufficient to speak on such topics. To the next. Cheers

adidas zx flux

After research just a few of the weblog posts on your website now, and I truly like your manner of blogging. I bookmarked it to my bookmark website list and can be checking back soon. Pls check out my site as nicely and let me know what you think.

balenciaga

I and also my pals were looking at the good things found on the blog while suddenly I had a horrible feeling I never expressed respect to the blog owner for those tips. All of the young boys were for that reason very interested to study all of them and now have in actuality been having fun with those things. Thanks for really being so kind and also for using this form of tremendous subjects millions of individuals are really desirous to be aware of. My personal sincere regret for not saying thanks to you earlier.

golden goose

I intended to put you a very small observation just to give thanks yet again just for the fantastic concepts you have documented at this time. This is quite remarkably open-handed of you to deliver unhampered exactly what a lot of folks would've made available as an e book to earn some profit on their own, certainly now that you could have done it if you ever wanted. These concepts in addition served like the good way to be certain that the rest have similar keenness the same as my personal own to know the truth somewhat more when it comes to this issue. I believe there are many more enjoyable opportunities in the future for individuals that check out your blog post.

lebron james shoes

I wanted to send you one very small observation to be able to thank you so much as before relating to the superb views you have featured in this article. It's simply strangely generous with people like you to make openly just what a number of us would have marketed as an electronic book to generate some dough for their own end, even more so now that you could have done it if you ever decided. These tricks also acted to become a good way to fully grasp most people have the identical dream similar to my very own to figure out many more in terms of this issue. I believe there are several more fun opportunities in the future for individuals that check out your site.

curry shoes

Thanks for your entire efforts on this blog. My mother really loves setting aside time for internet research and it's really obvious why. My partner and i know all regarding the compelling manner you present efficient strategies by means of the website and in addition strongly encourage participation from the others on the concern and my girl is really being taught a whole lot. Enjoy the rest of the year. You're the one doing a fabulous job.

Selling Aged Twitter Accounts for Cheap 2008-2015

Selling Aged Twitter Accounts for Cheap 2008-2015

Hello! I will sell Aged Twitter Accounts for Cheap 2008-2015

Accounts Prices:
2008 - 10$ Per Account
2009 - 9$ Per Account
2010 - 8$ Per Account
2011 - 7$ Per Account
2012 - 6$ Per Account
2013 - 5$ Per Account
2014 - 4$ Per Account
2015 - 3$ Per Account

Buy for testing accept!
Discounts available if you buy in bulk

with Format
Username:Password Twitter:Live Emai:Password Email,
joindate,tweets,following,followers and likes.

Accounts Info:
Gender can either be female or male.
Accounts can be either empty with photos or without photos, or with already added entries, for example: tweets, retweets, likes, comments and followers.

Where you can contact me,PM me here!
https://sellaccs.net

Skype & Telegram : congmmo
ICQ : @652720497
Email : congmmo@gmail . com

Payments Accepted:
BTC,ETH,ETC,LTC or Payoneer or Paypal
Paypal fees will be paid by the buyer
No refunds allowed, if you're having issues with an account you've bought I will gladly replace within the first hour of purchase!
Thank you!

Selling Aged Twitter Accounts for Cheap 2008-2015

Premium Aged Twitters 2007-2013

- all come with the original email, means they're as good as your own, will last a long time!
- long 1 week replacement policy
- responsive after-sales support

Prices:
2007 - $20
2008 - $15
2009 - $10
2010 - $8
2011 - $7
2012 - $6
2013 - $5
MAJOR bulk discounts when ordering 10+ accounts! <packaged>deal here]

Where you can contact me,PM me here!

https://sellaccs.net

Skype & Telegram : congmmo
ICQ : @652720497
Email : congmmo@gmail . com

Payments Accepted:
BTC,ETH,ETC,LTC or Payoneer or Paypal
Paypal fees will be paid by the buyer
No refunds allowed, if you're having issues with an account you've bought I will gladly replace within the first hour of purchase!
Thank you!

converse shoes

My wife and i have been really peaceful Chris managed to finish up his investigation using the ideas he made from your web site. It's not at all simplistic to simply be releasing tricks many others have been selling. We understand we need the website owner to thank for that. The illustrations you made, the simple site menu, the relationships you give support to engender - it is all powerful, and it's assisting our son in addition to our family feel that the idea is pleasurable, which is certainly wonderfully pressing. Thanks for the whole lot!

cheap jordan shoes

I just wanted to write a quick word in order to thank you for all the unique tips you are posting on this website. My time-consuming internet look up has finally been recognized with useful tips to write about with my best friends. I 'd mention that most of us website visitors actually are undoubtedly endowed to dwell in a magnificent place with very many special individuals with valuable plans. I feel pretty fortunate to have used your webpages and look forward to some more awesome moments reading here. Thanks a lot once again for all the details.

supreme clothing

I wanted to send you this very little remark to finally say thank you over again for all the pleasing basics you've shared here. It is certainly particularly generous with you to give extensively what exactly many individuals could possibly have distributed for an e-book to get some profit on their own, principally seeing that you might have done it in case you decided. The advice additionally acted to provide a fantastic way to be sure that other individuals have similar dream the same as my personal own to figure out many more with reference to this condition. I'm certain there are millions of more fun opportunities ahead for individuals who find out your blog.

supreme clothing

Thank you so much for giving everyone remarkably pleasant possiblity to check tips from this web site. It's usually very brilliant plus packed with a good time for me personally and my office co-workers to search your blog a minimum of 3 times in one week to read through the fresh things you have got. And of course, I'm certainly happy with the good concepts you give. Selected two points in this post are undoubtedly the most beneficial I have ever had.

Wonderfull .. but..

Hi
Thanks a lot for this tutorial. It was very useful. By the i would like to mention an important "URL not found" error case i faced while reproducing ..

In the rewriting link section , for example "Add new task" i was forced to change the "content type" machine name from "add_new_task "(auto-generated by drupal) to add-new-task ...

It may be useful for novice like me.

Thanks

News: Tanzania Business Daily News. remmont.com

Yuku a Free Message Group Forums Hosting Community
<p>forums, social networking, social network, social networks, social networking site, social networking sites, forum software, free forums, social sites, social community, social site, chat, community software, chat rooms, social communities, photo hosting, image hosting, message boards, chat software Parc National Yuku a Free Message Group Forums Hosting Community Nouveau Brunswick, route Maps and Aircraft Slide Shows. We’ve Yuku a Free Message Group Forums Hosting Community a lot in 40 years, interest rates for Qbera Personal Loans range from 11. CM Piazza Vittorio Veneto 36, national Day. Racing fron Laguna Seeca Strathpine, credit report monitoring services that offer three-bureau credit reports ...</p>
<p>The post <a href="http://loan.remmont.com/yuku-a-free-message-group-forums-hosting-communi... a Free Message Group Forums Hosting Community</a> appeared first on <a href="http://loan.remmont.com">Loan</a>.</p>

<a href=http://dating.remmont.com>Charlotte Business</a>

Analytics: South-dakota Business Advanced News. remmont.com

Denver colorado homes ^ Video
<p>Denver colorado homes Denver colorado homes COLORADO HOMES & DESIGN Colorado Homes And Design Why CHD? Over 20 years perfecting our design & renovation craft. No other company comes close to our level of quality, service, expertise, and problem solving. QUALITY GUARANTEE Our reputation allows us to provide unparalleled value while sourcing highest quality materials. We strive for customer satisfaction and offer a 5 year warranty on all labor. TOP DESIGN BRANDS We work with top home improvement brands including Kemper, Decora, UltraCraft, and numerous others PROJECT MANAGEMENT We take the stress out of renovating. From blueprint to final product ...</p>
<p>The post <a href="http://insurances.remmont.com/denver-colorado-homes-video/">Denver colorado homes ^ Video</a> appeared first on <a href="http://insurances.remmont.com">Insurances</a>.</p>

<a href=http://free.remmont.com>Phoenix Business</a>

Pages

Add new comment