relations variable of content-type drupal 7

2019-09-02 09:38发布

问题:

I have created a content type called Customer.

I am creating other content called reports.

A customer has several reports.

How could create a variable in the content-type reports relations with the customer's name on content-type customer?

thanks

回答1:

You should use Drupal Entity Reference module. Download, install and enable it, and then, you have to add a new field in content type "Reports", namely customer, of type "Entity reference" (this field type was added by Entity Reference module). Once you have added this field, you have to choose which kind of nodes can be referenced. Select Customer in the checkbox list.

You can also choose the way you want to determine which customer owns a report. You have several options: selection checkboxes, autocomplete field, etc. Take a second to determine if a Report should be linked to one or more customers. In case it must be linked to a single customer, make sure to limit the number of fields to one.

Using this module you will not only link the customer's name to the report, but you will also link the whole entity. You will be able to display the customer name as a link to the customer node.



标签: drupal-7