2

I use Parent and Child content types with a Field used in both types.

I would like Drupal to automatically propagate the Field value from Parent value to the Child field default value.

How to do this ? I am interested specificaly in an example for Location>Country field.

I use node reference or organic groups modules to set up Parent<->Child relationships.

  • Do you simply want to copy parent's value to child and allow them to change independently? – AgA Dec 21 '11 at 3:53
  • @AgA Child objects almost always have the location of parent object. I would like to use parent's values as defaults and to allow to change child's values independently only for certain roles. I need these values in child objects because I use child objects in views but I would like to filter on location properly and for performance reasons I would like location to be available directly from child objects. I would like also to limit data entry so that location can be entered once for all child objects (in the parent object). – Refineo Dec 21 '11 at 7:19
  • Then the simplest and easiest way is to go for @BetaRide's answer. Hardly any work you'll need to do to implement it. – AgA Dec 21 '11 at 7:28
3

Guess you want this to take place, when you create (aka save to db) a new node. You could do this in hook_node_presave.

0

There is a contributed module nodelocation_relationship that helps with this but it is currently available for Drupal 6 only.

0

In Drupal 7 use node reference url http://drupal.org/project/nodereference_url

When a new child is created it will reference-back to the parent. The parent is passed in the URL.

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.