This is for entity form submission.
Entityform has field collection field which contains computed field and other text field.

Inside computed field I need hostEntityId(in this case id of Entityform), but hostEntityID() is returning empty or null. Code I tested

/*get wrapper to which current field is attached*/
$wrapper = entity_metadata_wrapper($entity_type, $entity);

//get the host entity to which field collection is attached.
$entityid = $entity->hostEntityId();
dpm($entityid);// returning empty

$host = $entity->hostEntity( );
dpm($host); // work ok but entityid is missing

$bundle= $entity->hostEntityBundle();
dpm($bundle);//works ok , returning custom entityform type that I created.

$entity_field[0]['value'] = "some more computation..";

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.