1

I want to do something in my website, but I can't figure how. Let me explain:

I have a content type called bananas, and I have created a lot of bananas pages.

I want to create a content type called peaches and add a field with a select list called "Existing bananas on this peach" - and I want to be able to select from all the bananas pages my website has. Then, if it is not asking too much, I want this field to be a link to the specific bananas page.

Am I making myself clear? For me it's simple, but I don't think there's a way on Drupal to do that. Or maybe there is, but I'm just not seeing it.

Hard or easy, do you have any solution?

Thank you so much in advance, hope you guys can help me.

1

Assuming you are using Drupal 7, I think you need the Entity Reference module.

This module provides a field that you can add to your content type peaches and provides the requested widget that allows you to select from all the bananas nodes your website has. When outputting the peaches node, the standard formatter (that the Entity Reference module offers) creates a link using the selected bananas node's title.

| improve this answer | |
  • 1
    Thank you! Entity Reference module solved my problem. Everything works perfectly! – Drii7 Dec 23 '14 at 12:31
0

You can't do this with just Drupal core, but this is easy to do with either https://www.drupal.org/project/references and https://www.drupal.org/project/entityreference. Simply download and enable one of these modules (Node Reference is in the References project), add a field of that type to the new Peaches content type called "Existing Bananas", and configure the field's options and display. You'll have a number of options in both the form field configuration (auto complete, list, etc) and the display (render, link, plain text of title, etc). It's hard to say which is better for your site without knowing what else you are doing. I personally use Entity Reference more often, but that's largely because it is a requirement for Organic Groups and Commerce which I often end up using. Entity Reference requires both Entity API and CTools which will add a lot of code if you aren't already using these.

I would test these modules on a development version of your site and see which one works best for you, but either one should work.

| improve this answer | |
  • Thank you for your anwser. Entity Reference module solved my problem. – Drii7 Dec 23 '14 at 12:31

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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