This project is not covered by Drupal’s security advisory policy.

Prepopulates an EntityReference value from Current Entity on the page(as returned by menu_get_object()).

What it does

Similar to Entityreference Prepoplate but it defaults the value of the entity reference field to the current Entity of the page as returned by menu_get_object().

What? Why?

In most cases this wouldn't make sense because if you are at an entity add form page like node/add/article then menu_get_object will return an empty result.

This module was made to work with Entityforms as the entity type containing the Entity Reference field(though it will work with other entity types) . This allows an Entityreference field on the EntityForm to automatically be set to the Entity it was displayed with at the time it was submitted.

It will work with other Entity Types as the container of the entity reference field but in most cases it won't make sense.

Example Usage

  1. Entityform as a contact form on node pages where the node is automatically referenced in the submission.
  2. Entityform as a contest entry form that will be displayed with nodes of the type "Contest" where each Contest needs that same fields for entry but should record which Contest the user was submitted for.

Code Originally from: Entityreference Prepopulate


Ted Bowman
The author can be contacted for paid customizations of this module as well as Drupal consulting and development. Ted also teaches Drupal module development courses online with Six Mile Tech.


On-going development is sponsored by Six Mile Tech

Project Information