Reputation: 23
Drupal has content types set as:
- Book
- Contributor
Custom CCK fields are added to above content types.
Contributor has type id set as:
- Author
- Seller
- Reader
The above contributor type id is to be added (currently with node reference) to "Book" with Author and contrition typpe "Seller".
example:
Book Contributor Contributor Type
-------------------------------- -------------- ---------------
Act Like a Lady, Think Like a Man Steve Harvey Atuhor
Act Like a Lady, Think Like a Man Steve Harvey Seller
The Alchemist Paulo Coelho Reader
The Happiness Project Gretchen Rubin Atuhor
The Happiness Project Gretchen Rubin Seller
What would the best approach to achieve this. With current setup we are able to add contributor id, how to add "contributor type" with it as well.
Upvotes: 1
Views: 1321
Reputation: 5015
If I understand you correctly
Book
and
Contributor
Book
content type has a node reference field which points to
nodes of type Contributor
Actually your question, if I have understood correctly is a good one. The answer is not trivial.You need to somehow "group" the node reference field with a select list. This way every time you make a node reference, you also select the contributor type. What you're asking for essentially is "Multigroup" feature. Its available only in CCK version 3.You cannot do this with CCK Version 2 series which is what you're probably using. Unfortunately a stable version 3 of CCK is still not available. However a development is available at http://drupal.org/node/484068 . As of today, a lot people are using this version already (see http://drupal.org/project/usage/484068 ) and from what I've read, its quite stable already.
So in summary:
sites/all/modules
folder.
Remove the CCK 2.x folder if it exists there. Please take backups etc. of your site -- just in case something breaks.MG
. You can do this under Manage fields -> Add a
New group (Select Multigroup
from the dropdown) Link to Contributor
. Make sure the parent of Link to Contributor
is
MG
(you can achieve this by grabbing the anchor and moving the field to the right,
just like you do for a hierarchical taxonomy tree.Contributor Type
. Again,
make sure the parent is MG
. Book
. You will
be able to select the Contributor and the Contributor Type. To add
more Contributors to a book
, simply press the Add More Values
in the Node Edit Form.And BTW since I found your question interesting, I've tried it out and it seems to work correctly for me!
Upvotes: 1