I'm new to Drupal and have been watching lots of videos on entity relationships but am a bit lost still....trying to wrap my head around the differences between nodes, entities, etc. and how to define relationships.

What I would like to do is have 2 pieces of content - Company and Program.

The company information will be filled in by an administrator of the site (company name, address, phone, website, etc) -- these values are only editable by the administrator but can be read by any authenticated user.

Then any authenticated user can create a Program which will have its own set of fields (program name, date, program director, etc.)

Each Program is considered a child of Company and so the Program would also have read only fields that present the company info.

Can someone please point me in the right direction of how to link the Company directly to the Program. I have seen ways of adding a select list field that would allow the user to select a Company from a list of companies...but I want this to default to the same company each time.

Thank you for any ideas/help.


1 Answer 1


There are several modules to use in conjunction.

Firstly, you need Entity Reference and its dependency, Entity API https://www.drupal.org/project/entity https://www.drupal.org/project/entityreference

Install those two modules the normal way.

Others have written add on modules for entity reference such as Entity Reference Prepopulate: http://drupal.org/project/entityreference_prepopulate That module can be helpful for prepopulating values for the entity reference fields you create.

So after you've installed the modules you can go to the Manage Fields page for you Program content type, and add a new Entity Reference field.

Might call this field "Company"

Entity Reference Create

Click Save

On the field settings page, Select the Target type (entity type) as "Node" For the Target bundles (content types in the case of node) select your Program content type Optionally you can chose to sort the options for the entity reference field by a property of the node such as title.

Entity Reference Field Settings

Click Save

On the next screen you can set the default Company for the Reference field, or you can configure add modules such as Entity Reference Prepopulate to configure defaults based on context.

Entity Reference set default value

Click Save

Now you can edit or create Program nodes and reference a company node from them.

For this example I had created a Company node called "A Company"

Create Program

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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