Hi,
I have tried to use your module with addressfield and geofield as part of a field collection.
Both 7.x-1.0-beta5 version and 7.x-1.x-dev version don't work.
7.x-1.x-dev version reported an error at row 631 of addressfield_autocomplete.module in the function _addressfield_autocomplete_widget_get_field_value.
"undefined property $entity->type".
I have found that the offending row is
$bundle_name = $entity_type == 'taxonomy_term' ? $entity->vocabulary_machine_name : $entity->type;

With the field collection module $entity_type is always "field_collection_item" while $entity->type is not defined, but you can substitute it with $entity->field_name.

So I have solved the problem changing row 631 from

$bundle_name = $entity_type == 'taxonomy_term' ? $entity->vocabulary_machine_name : $entity->type;

to
if(!property_exists($entity, 'type') && isset($entity->field_name) )
{
$bundle_name = $entity->field_name;
}
else
{
$bundle_name = $entity_type == 'taxonomy_term' ? $entity->vocabulary_machine_name : $entity->type;

}

....
follows
$field_name = $instance['widget']['settings']['addressfield_autocomplete_field'];

$field_instance = field_info_instance($entity_type, $field_name, $bundle_name);

I have uploaded two files: one for the beta5 version and the other for the dev version; both seem to be working.

Comments

giaza’s picture

giaza’s picture

Issue summary: View changes
StatusFileSize
new6.66 KB
mvlabat’s picture

Thanks for your work. The fix seems to be working.
Here is the patch in right format.

tibezh’s picture

Status: Active » Needs review
StatusFileSize
new860 bytes
new699 bytes

I have some problem but with user entity. My patch fix field collections and user entity (maybe other entities) as well.

tibezh’s picture

Here is a new patch for a module, I have written universal code for fetch bundle of any entity type use Entity API module.

thedut’s picture

#5 is a create patch. I confirm it works with Field Collection and User addressbook.

  • adammitchell committed 25f2e84 on 7.x-1.x
    Issue #2515404 by tibezh, mvlabat, giaza: Doesn't work with field...
adammitchell’s picture

Hi all,

Sorry for the delay in responding. I have committed a fix to the dev branch which should hopefully mean that it is fixed universally. It also does not require anymore dependencies.

Would be great if you guys could find the time to review it.

Thanks,

Adam

thedut’s picture

Hello Adam,

I tested your fix with a taxonomy term entity :

  • version 7.x-1.0-beta5 (current stable release) fails to populate the geofield field, displaying a notice error about entity type on saving the taxonomy term.
  • version Version: 7.x-1.0-beta5+13-dev, 2015-Dec-09 totaly fix this issue.

I didn't try this fix with field collection entity.